Skip to content
Snippets Groups Projects
Commit 33536bdb authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-190: create convenience sched_set per project

parent c0699a06
Branches
Tags
1 merge request!252Resolve TMSS-190
......@@ -52,7 +52,7 @@ def populate_test_data():
# only add (with expensive setup time) example data when developing/testing and we're not unittesting
if isTestEnvironment() or isDevelopmentEnvironment():
from lofar.sas.tmss.tmss.exceptions import TMSSException
from lofar.sas.tmss.test.tmss_test_data_django_models import SchedulingSet_test_data, SchedulingUnitDraft_test_data
from lofar.sas.tmss.test.tmss_test_data_django_models import 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
......@@ -67,12 +67,7 @@ def populate_test_data():
if 'Commissioning' not in tmss_project.tags:
continue
for set_nr in range(2):
scheduling_set_data = SchedulingSet_test_data(name="Scheduling Set UC1 example %s (%s)" % (set_nr, tmss_project.name), project=tmss_project)
scheduling_set = models.SchedulingSet.objects.create(**scheduling_set_data)
logger.info('created test scheduling_set: %s', scheduling_set.name)
for scheduling_set in tmss_project.scheduling_sets.all():
for unit_nr in range(2):
# 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
......@@ -137,6 +132,8 @@ def populate_cycles(apps, schema_editor):
def populate_projects(apps, schema_editor):
from lofar.sas.tmss.test.tmss_test_data_django_models import SchedulingSet_test_data
for name, rank in (("high", 3), ("normal", 2), ("low", 1)):
tmss_project = models.Project.objects.create(name=name,
description="Project for all TMSS tests and commissioning (%s priority)" % (name,),
......@@ -149,6 +146,9 @@ def populate_projects(apps, schema_editor):
tmss_project.cycles.set([models.Cycle.objects.get(name="Cycle 14")])
tmss_project.save()
# for convenience, create a schedulingset for each project
models.SchedulingSet.objects.create(**SchedulingSet_test_data(name="Test Scheduling Set", project=tmss_project))
def populate_resources(apps, schema_editor):
ResourceType.objects.create(name="lta_storage", description="Amount of storage in the LTA (in bytes)", quantity=Quantity.objects.get(value=Quantity.Choices.BYTES.value))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment