diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index c431ef0593401738f17ad8b5a2b05f0ffc372cb7..2d342c763084b54567778eeee5ba307d139ab7a3 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py @@ -531,7 +531,7 @@ 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 = [] - 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) + 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) if not schedulable_units_queue_B.exists(): return placed_units @@ -557,10 +557,8 @@ class Scheduler: placed_units.append(best_B_candidate_for_gap.scheduling_unit) - # TODO: at this moment we have no means to distinguish between a placed and an unplaced schedulable (B) unit. When we can make that distinction, remove the "if do_schedule" below, and always recurse. - if do_schedule: - # Recurse. There may be a new gap, so let's try to squeeze in more. - placed_units.extend(self.place_B_priority_units_in_gaps_around_scheduling_unit(best_B_candidate_for_gap.scheduling_unit, do_schedule=do_schedule)) + # Recurse. There may be a new gap, so let's try to squeeze in more. + placed_units.extend(self.place_B_priority_units_in_gaps_around_scheduling_unit(best_B_candidate_for_gap.scheduling_unit, do_schedule=do_schedule)) return placed_units