From aa054f8c67260bb1467fbed46a6983a342ff2da4 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Thu, 13 Jan 2022 16:43:06 +0100 Subject: [PATCH] TMSS-671: schedule upon project/sub priority_rank or queue change events --- .../scheduling/lib/dynamic_scheduling.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index 741bca322db..1fbbd24d1a0 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py @@ -494,15 +494,24 @@ class TMSSDynamicSchedulingMessageHandler(TMSSEventMessageHandler): def onSchedulingUnitBlueprintConstraintsUpdated(self, id: int, scheduling_constraints_doc: dict): + self.onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(id) + + def onSchedulingUnitBlueprintPriorityRankUpdated(self, id: int, priority_rank: float): + self.onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(id) + + def onSchedulingUnitBlueprintPriorityQueueUpdated(self, id: int, priority_queue: str): + self.onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(id) + + def onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(self, id: int): scheduling_unit_blueprint = models.SchedulingUnitBlueprint.objects.get(id=id) if scheduling_unit_blueprint.status.value == models.SchedulingUnitStatus.Choices.UNSCHEDULABLE.value: - logger.info("constraints for unschedulable scheduling unit id=%s changed: setting status to schedulable which will triggering a dynamic scheduling update...", id) + logger.info("constraints/queue/priority for unschedulable scheduling unit id=%s changed: setting status to schedulable which will triggering a dynamic scheduling update...", id) mark_independent_subtasks_in_scheduling_unit_blueprint_as_schedulable(scheduling_unit_blueprint) elif scheduling_unit_blueprint.status.value == models.SchedulingUnitStatus.Choices.SCHEDULED.value: - logger.info("constraints for scheduled scheduling unit id=%s changed: unscheduling it, which will triggering a dynamic scheduling update...", id) + logger.info("constraints/queue/priority for scheduled scheduling unit id=%s changed: unscheduling it, which will triggering a dynamic scheduling update...", id) unschedule_subtasks_in_scheduling_unit_blueprint(scheduling_unit_blueprint) elif scheduling_unit_blueprint.status.value == models.SchedulingUnitStatus.Choices.SCHEDULABLE.value: - logger.info("constraints for schedulable scheduling unit id=%s changed: triggering a dynamic scheduling update...", id) + logger.info("constraints/queue/priority for schedulable scheduling unit id=%s changed: triggering a dynamic scheduling update...", id) self.scheduler.trigger() @@ -551,6 +560,11 @@ class TMSSDynamicSchedulingMessageHandler(TMSSEventMessageHandler): self.scheduler.trigger() + def onProjectPriorityRankUpdated(self, name: str, priority_rank: float): + logger.info("project '%s' priority_rank changed to %s", name, priority_rank) + self.scheduler.trigger() + + def onReservationCreated(self, id: int): self._onReservationCreatedOrUpdated(id) -- GitLab