diff --git a/SAS/TMSS/backend/services/scheduling/lib/constraints.py b/SAS/TMSS/backend/services/scheduling/lib/constraints.py index e206062c66aaa71f59f4a6acbf35458a39df8869..51556b93af21cd8037a5feaf97f6c87ece9be6c8 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/constraints.py +++ b/SAS/TMSS/backend/services/scheduling/lib/constraints.py @@ -2302,8 +2302,9 @@ def determine_unschedulable_reason_and_mark_unschedulable_if_needed(scheduling_u if not can_run_without_used_stations(scheduling_unit, lower_bound=scheduling_unit.scheduled_observation_start_time, upper_bound=scheduling_unit.scheduled_observation_stop_time): missing_stations = get_missing_stations_for_scheduling_unit(scheduling_unit) - msg = "Stations %s are already used" % (','.join([str(s) for s in missing_stations]), ) - return mark_independent_subtasks_in_scheduling_unit_blueprint_as_unschedulable(scheduling_unit, msg) + if missing_stations: + msg = "Stations %s are already used" % (','.join([str(s) for s in missing_stations]), ) + return mark_independent_subtasks_in_scheduling_unit_blueprint_as_unschedulable(scheduling_unit, msg) if scheduling_unit.earliest_possible_cycle_start_time is None or scheduling_unit.latest_possible_cycle_stop_time is None: return mark_independent_subtasks_in_scheduling_unit_blueprint_as_unschedulable(scheduling_unit, "unknown cycle bounds") diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index de506eef3c362b26a642968d957bda46b2f8b550..6a71178d3e024bb81ce56b3a27f0bf5532d8712a 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py @@ -258,7 +258,10 @@ class Scheduler: self.log_schedule(log_level=logging.DEBUG) except Exception as e: - if isinstance(e, SubtaskSchedulingException): + if isinstance(e, SchedulerInterruptedException): + # Scheduler was interrupted, re-raise and let the scheduling loop handle it + raise + elif isinstance(e, SubtaskSchedulingException): logger.warning("Could not schedule fixed_time-scheduled scheduling unit id=%d: %s", schedulable_unit.id, e) else: logger.exception("Could not schedule fixed_time-scheduled scheduling unit id=%d: %s", schedulable_unit.id, e) @@ -940,6 +943,7 @@ class TMSSDynamicSchedulingMessageHandler(TMSSEventMessageHandler): def onSchedulingUnitBlueprintCreated(self, id: int): '''prepare the new scheduling_unit for scheduling. Set unschedulable if project not active.''' + logger.info("onSchedulingUnitBlueprintCreated(id=%s)",id) scheduling_unit = models.SchedulingUnitBlueprint.objects.get(id=id) # mark unschedulable if project not active