From cf165475caa1e46e9bae1c3734653800cd626ce3 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Tue, 24 Oct 2023 09:28:47 +0200 Subject: [PATCH] TMSS-2809: only use the known scheduled starttime when evaluating in the same window, else compute a new one --- SAS/TMSS/backend/services/scheduling/lib/constraints.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SAS/TMSS/backend/services/scheduling/lib/constraints.py b/SAS/TMSS/backend/services/scheduling/lib/constraints.py index 5ffd1595761..1ac68eba840 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/constraints.py +++ b/SAS/TMSS/backend/services/scheduling/lib/constraints.py @@ -2079,13 +2079,14 @@ def compute_scores_for_units_with_start_time(units_with_start_time: [SchedulingU def compute_scheduling_unit_start_time(scheduling_unit: models.SchedulingUnitBlueprint, lower_bound: datetime, upper_bound: datetime, gridder: Gridder) -> SchedulingUnitAndStartTime: '''Compute best fitting start_time, somewhere between the earliest_possible and the optimal at transit. At this start_time, compute the "fitness" scores per constraint for the given scheduling_unit depending on the sub's constrains-template/doc.''' - # if the unit is already scheduled, evaluate the scores at the known scheduled_start_time, + # if the unit is already scheduled within the given bounds, evaluate the scores at the known scheduled_start_time, # else compute a weighted between earliest- and optimal start_time. if scheduling_unit.status.value in models.SchedulingUnitStatus.ACTIVE_OR_FINISHED_STATUS_VALUES: # but scheduled B-prio units may get a new starttime, so skip those. if not (scheduling_unit.priority_queue.value == models.PriorityQueueType.Choices.B.value and scheduling_unit.status.value == models.SchedulingUnitStatus.Choices.SCHEDULED.value): - return SchedulingUnitAndStartTime(scheduling_unit=scheduling_unit, start_time=scheduling_unit.scheduled_start_time) + if scheduling_unit.scheduled_start_time >= lower_bound and scheduling_unit.scheduled_start_time <= upper_bound: + return SchedulingUnitAndStartTime(scheduling_unit=scheduling_unit, start_time=scheduling_unit.scheduled_start_time) at = get_at_constraint_timestamp(scheduling_unit) if at: -- GitLab