Skip to content
Snippets Groups Projects
Commit 32c47bda authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

non-triggered dynamically scheduled units are not allowed to unschedule fixed_time scheduled units

parent abf5d1d9
No related branches found
No related tags found
No related merge requests found
......@@ -1163,6 +1163,10 @@ def unschededule_blocking_scheduled_units_if_needed_and_possible(candidate_sched
if candidate_scheduling_unit.priority_queue.value == models.PriorityQueueType.Choices.B.value:
overlapping_scheduled_scheduling_units = overlapping_scheduled_scheduling_units.exclude(priority_queue__value=models.PriorityQueueType.Choices.A.value)
# non-triggered dynamically scheduled units are not allowed to unschedule fixed_time scheduled units
if candidate_scheduling_unit.is_dynamically_scheduled and not candidate_scheduling_unit.interrupts_telescope:
overlapping_scheduled_scheduling_units = overlapping_scheduled_scheduling_units.exclude(scheduling_constraints_doc__scheduler='fixed_time')
if not overlapping_scheduled_scheduling_units.exists():
logger.debug('no scheduled scheduling_units are blocking candidate scheduling_unit id=%s name=%s, nothing needs to be unscheduled', candidate_scheduling_unit.id, candidate_scheduling_unit.name)
return
......
......@@ -1368,6 +1368,20 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, Schedul
'''
return self.draft.scheduling_set.project
@property
def is_dynamically_scheduled(self) -> bool:
'''is this unit scheduled dynamically?'''
if self.scheduling_constraints_doc is not None:
return self.scheduling_constraints_doc.get('scheduler', '') == 'dynamic'
return False
@property
def is_fixed_time_scheduled(self) -> bool:
'''is this unit scheduled at fixed time?'''
if self.scheduling_constraints_doc is not None:
return self.scheduling_constraints_doc.get('scheduler', '') == 'fixed_time'
return False
@property
def main_observation_used_stations(self) -> list:
'''return the list of used stations of the main observation task'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment