Commit 9db75bf89d4f04c7abb3190d947c30fe6a38b797
1 parent
c6af49bf
Exists in
dev
Add quota for sequence in A_scheduler
Showing
1 changed file
with
10 additions
and
5 deletions
Show diff stats
src/core/pyros_django/scheduling/A_Scheduler.py
... | ... | @@ -223,10 +223,12 @@ class A_Scheduler(Agent): |
223 | 223 | """ |
224 | 224 | |
225 | 225 | |
226 | - def update_db_quota_sequence(sequence, quota_attributes, id_period, night_id, d_total=sequence_info['duration']): | |
227 | - sequence_quota = sequence.quota | |
228 | - sp_quota = sequence.scientific_program | |
229 | - institute_quota = | |
226 | + def update_db_quota_sequence(sequence_id, quota_attributes): | |
227 | + sequence = Sequence.objects.get(id=sequence_id) | |
228 | + new_quota = Quota() | |
229 | + new_quota.set_attributes_and_save(quota_attributes) | |
230 | + sequence.quota = new_quota | |
231 | + sequence.save() | |
230 | 232 | |
231 | 233 | def _compute_schedule_1(self): |
232 | 234 | """Simple scheduler based on selection-insertion one state algorithm. |
... | ... | @@ -346,7 +348,10 @@ class A_Scheduler(Agent): |
346 | 348 | if scientific_program_id not in scientific_program_ids: |
347 | 349 | scientific_program_ids.append(scientific_program_id) |
348 | 350 | # --- TODO |
349 | - # update_db_quota_sequence( id_period, night_id, d_total=sequence_info['duration'] ) | |
351 | + quota_attributes = {} | |
352 | + quota_attributes["total"] = sequence_info["duration"] | |
353 | + quota_attributes["schedule"] = sequence_info["duration"] | |
354 | + update_db_quota_sequence(sequence_info["id"], quota_attributes) | |
350 | 355 | else: |
351 | 356 | sequence_info['error'] = f"File {ephfile} not exists" |
352 | 357 | sequence_infos.append(sequence_info) | ... | ... |