diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py b/SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py index db045de8f48b8357fac6dc34e5814e681b90a66a..2c90343ecfdfcc1df2e7935f740344be3ae9e763 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py @@ -709,18 +709,6 @@ class TaskTemplate(AbstractSchemaTemplate): if group.get('max_nr_missing', 0) > len(group.get('stations', [])): raise RuleValidationException("station_groups max_nr_missing should be smaller than or equal to the number of stations in the group. max_nr_missing=%s #stations=%s" % (group.get('max_nr_missing', 0), len(group.get('stations', [])))) - # cannot mix lofar1 and lofar2 stations in new(er) templates - if self.state.value in (TemplateState.Choices.ACTIVE.value, TemplateState.Choices.DEVELOPMENT.value): - from lofar.sas.tmss.tmss.tmssapp.conversions import get_lofar2_stations - specified_stations = set(sum([group['stations'] for group in station_groups], [])) - lofar2_stations = set(get_lofar2_stations()) - specified_lofar2_stations = specified_stations.intersection(lofar2_stations) - if len(specified_lofar2_stations)>0 and specified_lofar2_stations != specified_stations: - raise RuleValidationException("Mixing LOFAR1 and LOFAR2 stations is not supported. TaskTemplate name='%s' version=%s state=%s\n - specified: %s\n - LOFAR2: %s" % ( - self.name, self.version, self.state.value, - ','.join(s for s in sorted(specified_stations)), - ','.join(s for s in sorted(lofar2_stations)))) - saps = json_doc.get('station_configuration',{}).get('SAPs',[]) all_subbands = set(sum([sap['subbands'] for sap in saps], [])) if len(all_subbands) > 488: diff --git a/SAS/TMSS/backend/test/t_scheduling_units.py b/SAS/TMSS/backend/test/t_scheduling_units.py index a2ec4c2778eabd5efb526b14c964e1744902d777..5ca8ce092951f2b9097bef929c96f7b4c5d53f99 100644 --- a/SAS/TMSS/backend/test/t_scheduling_units.py +++ b/SAS/TMSS/backend/test/t_scheduling_units.py @@ -543,21 +543,22 @@ class SchedulingUnitBlueprintStateTest(unittest.TestCase): lofar2_stations = get_lofar2_stations() self.assertIn('DE605', lofar2_stations) - # make sure that the previously blueprinted tasks don't validate any more - with self.assertRaises(RuleValidationException): - for task in blueprint.task_blueprints.all(): - task.validate_specifications_doc() + # JS 2024-02-26: as per L2SS-1511 combining lofar1&2 stations in one observation IS allowed, + # so the RuleValidationException should NOT be raised anymore, and all specs should validate. + for task in blueprint.task_blueprints.all(): + task.validate_specifications_doc() # start a subtask so that the unit is advance enough to skip rule-based validation on specs read access set_subtask_state_following_allowed_transitions(blueprint.subtasks.first(), 'started') blueprint.refresh_from_db() self.assertEqual(blueprint.status.value, models.SchedulingUnitStatus.Choices.OBSERVING.value) - # try to create a draft copy, which should fail due to the invalid specs - with self.assertRaises(ValidationException): - create_scheduling_unit_draft_from_scheduling_unit_blueprint(blueprint) + # try to create a draft copy + # JS 2024-02-26: as per L2SS-1511 combining lofar1&2 stations in one observation IS allowed, + # so the RuleValidationException should NOT be raised anymore, and the copy should be created. + create_scheduling_unit_draft_from_scheduling_unit_blueprint(blueprint) - # try again, but this time remove lofar2 stations when creating the draft so that it can be blueprinted + # try again, but this time remove lofar2 stations when creating the draft draft_copy = create_scheduling_unit_draft_from_scheduling_unit_blueprint(blueprint, remove_lofar2_stations=True) blueprint_from_copy = create_scheduling_unit_blueprint_and_tasks_and_subtasks_from_scheduling_unit_draft(draft_copy)