diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index 741bca322db231f8a980874561a7a7bd0811266a..1fbbd24d1a06accb29393923c00e5a51abdc9434 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)