From 1048e4962f88ee44da3c89f7b630ffb833d90dc9 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 28 Nov 2023 18:09:58 +0100
Subject: [PATCH] TMSS-2836: only pass normal-constrained units to the
 scheduler. The relational units are handled already.

---
 SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
index 4b4d7c7efc6..1aceae9d986 100644
--- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
+++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
@@ -1260,6 +1260,7 @@ def get_dynamically_schedulable_scheduling_units(priority_queue: models.Priority
     if include_scheduled:
         states += [models.SchedulingUnitStatus.Choices.SCHEDULED.value]
     scheduling_units = models.SchedulingUnitBlueprint.objects.filter(status__value__in=states).filter(obsolete_since__isnull=True)
+    scheduling_units = scheduling_units.filter(scheduling_constraints_template__name='constraints')
     scheduling_units = scheduling_units.filter(scheduling_constraints_doc__scheduler='dynamic')
 
     if priority_queue is not None:
@@ -1274,6 +1275,7 @@ def get_dynamically_schedulable_scheduling_units(priority_queue: models.Priority
 def get_fixed_time_schedulable_scheduling_units() -> QuerySet:
     '''get a result QuerySet of all fixed_time schedulable scheduling_units'''
     scheduling_units = models.SchedulingUnitBlueprint.objects.filter(status__value=models.SchedulingUnitStatus.Choices.SCHEDULABLE.value).filter(obsolete_since__isnull=True)
+    scheduling_units = scheduling_units.filter(scheduling_constraints_template__name='constraints')
     scheduling_units = scheduling_units.filter(scheduling_constraints_doc__scheduler='fixed_time')
     scheduling_units = scheduling_units.order_by('-updated_at')
     return scheduling_units
-- 
GitLab