diff --git a/SAS/TMSS/src/tmss/tmssapp/populate.py b/SAS/TMSS/src/tmss/tmssapp/populate.py index d9f964aae6c3d0b9ac70e02c653edcce27eb4c2a..b786248f34773046434364d3ddc887ecd6d59e3a 100644 --- a/SAS/TMSS/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/src/tmss/tmssapp/populate.py @@ -55,6 +55,12 @@ def populate_test_data(): from lofar.sas.tmss.test.tmss_test_data_django_models import SchedulingSet_test_data, SchedulingUnitDraft_test_data from lofar.sas.tmss.tmss.tmssapp.tasks import create_task_blueprints_and_subtasks_from_scheduling_unit_draft, create_task_blueprints_and_subtasks_and_schedule_subtasks_from_scheduling_unit_draft from lofar.sas.tmss.tmss.tmssapp.subtasks import schedule_subtask + from lofar.common.json_utils import get_default_json_object_for_schema + + constraints_template = models.SchedulingConstraintsTemplate.objects.get(name="constraints") + constraints_spec = get_default_json_object_for_schema(constraints_template.schema) + + strategy_template = models.SchedulingUnitObservingStrategyTemplate.objects.get(name="UC1 CTC+pipelines") # create a Test Scheduling Set UC1 under project TMSS-Commissioning tmss_project = models.Project.objects.get(name="TMSS-Commissioning") @@ -67,8 +73,6 @@ def populate_test_data(): logger.info('created test scheduling_set: %s', scheduling_set.name) for unit_nr in range(5): - strategy_template = models.SchedulingUnitObservingStrategyTemplate.objects.get(name="UC1 CTC+pipelines") - # the 'template' in the strategy_template is a predefined json-data blob which validates against the given scheduling_unit_template # a user might 'upload' a partial json-data blob, so add all the known defaults @@ -79,7 +83,9 @@ def populate_test_data(): scheduling_set=scheduling_set, requirements_template=strategy_template.scheduling_unit_template, requirements_doc=scheduling_unit_spec, - observation_strategy_template=strategy_template) + observation_strategy_template=strategy_template, + scheduling_constraints_doc=constraints_spec, + scheduling_constraints_template=constraints_template) scheduling_unit_draft.tags = ["TEST", "UC1"] scheduling_unit_draft.save()