diff --git a/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service b/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service index 50d4f8cf017c3ed4b57ff36b8baf1101c23d6972..9421e18a003c16234dd425fa4d9523a64bf4487e 100755 --- a/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service +++ b/SAS/TMSS/backend/services/scheduling/bin/tmss_scheduling_service @@ -69,8 +69,8 @@ def main(): logging.getLogger('lofar.sas.tmss.services.scheduling').level = logging.DEBUG logging.getLogger('lofar.sas.tmss.services.scheduling.constraints').level = logging.DEBUG - with create_subtask_scheduling_service(options.exchange, options.broker): - with create_dynamic_scheduling_service(options.exchange, options.broker): + with create_dynamic_scheduling_service(options.exchange, options.broker): + with create_subtask_scheduling_service(options.exchange, options.broker): waitForInterrupt() if __name__ == '__main__': diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index 89f579bc5a11383b9031258a6560573d3dc76d8b..b9459217c412dc5fdb456e265a62152d4b46540e 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py @@ -591,6 +591,10 @@ class Scheduler: '''try to schedule one or more scheduling units from queue B in the gap between the given scheduled_unit and its previous observed+ unit''' placed_units = [] + if not self.dynamic_scheduling_enabled: + logger.debug("skipping place_B_priority_units_in_gaps because dynamic_scheduling is not enabled") + return placed_units + logger.debug("place_B_priority_units_in_gaps: looking for B-queue units to be placed in gap(s) around unit id=%s", scheduling_unit.id) schedulable_units_queue_B = get_dynamically_schedulable_scheduling_units(priority_queue=models.PriorityQueueType.objects.get(value=models.PriorityQueueType.Choices.B.value)).exclude(id=scheduling_unit.id).filter(placed=False) diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py b/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py index 48fc5153fb8932afd2b339dfa4325507b7f266af..332446260847bd48e909938cd853e47931b18a95 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py @@ -935,8 +935,14 @@ def get_gaps_to_previous_and_next_observations_in_scheduling_unit(scheduling_uni return ((datetime.min, datetime.max), (datetime.min, datetime.max)) observation_subtasks = scheduling_unit.subtasks.filter(specifications_template__type__value='observation').filter(obsolete_since__isnull=True).all() + + # quick fix to ignore 24/7 IDOLS observations, see https://support.astron.nl/jira/browse/TMSS-2638 + # ToDo: should be fixed in a more generic way: https://support.astron.nl/jira/browse/TMSS-2639 + idols_observations = models.Subtask.objects.filter(task_blueprint__scheduling_unit_blueprint__draft__scheduling_set__project='IDOLS').filter(specifications_template__type__value='observation').filter(obsolete_since__isnull=True).all() + to_exclude_subtasks = observation_subtasks | idols_observations + # get all gaps, exclude observations in this unit. - results = [get_gaps_to_previous_and_next_observations(s, exclude_subtasks=observation_subtasks, include_defined_unschedulable=include_schedulable_unschedulable) for s in observation_subtasks] + results = [get_gaps_to_previous_and_next_observations(s, exclude_subtasks=to_exclude_subtasks, include_defined_unschedulable=include_schedulable_unschedulable) for s in observation_subtasks] # gather overall gaps. overall_result = [[results[0][0][0], results[0][0][1]], [results[0][1][0], results[0][1][1]]] @@ -946,8 +952,8 @@ def get_gaps_to_previous_and_next_observations_in_scheduling_unit(scheduling_uni overall_result[0][1] = min(result[0][1], overall_result[0][1]) # gap to next - overall_result[1][0] = min(result[1][0], overall_result[1][0]) - overall_result[1][1] = max(result[1][1], overall_result[1][1]) + overall_result[1][0] = max(result[1][0], overall_result[1][0]) + overall_result[1][1] = min(result[1][1], overall_result[1][1]) # return as immutable tuple return ((overall_result[0][0],overall_result[0][1]),(overall_result[1][0],overall_result[1][1]))