diff --git a/SAS/TMSS/src/migrate_momdb_to_tmss.py b/SAS/TMSS/src/migrate_momdb_to_tmss.py index 13efa43bbc7759f453875c51cdbfb3f9b5734fb9..e2d0c8102979755204db98ddc326c00a62a44230 100755 --- a/SAS/TMSS/src/migrate_momdb_to_tmss.py +++ b/SAS/TMSS/src/migrate_momdb_to_tmss.py @@ -512,8 +512,7 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project): "priority": project.priority_rank, # todo: correct to derive from project? # optional: "start_time": start_time, - "stop_time": stop_time, - "schedule_method": models.ScheduleMethod.objects.get(value="manual"), # todo: correct? Or leave None? + "stop_time": stop_time # "created_or_updated_by_user" = None, # "raw_feedback" = None, # "do_cancel": None, diff --git a/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py b/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py index 694f54c9fbf4c118607ac40dedb0de76c33ef7aa..f375f739ae5a435eff01474107753925b5b4208f 100644 --- a/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py +++ b/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.9 on 2020-11-03 14:44 +# Generated by Django 3.0.9 on 2020-11-17 13:44 from django.conf import settings import django.contrib.postgres.fields @@ -455,15 +455,6 @@ class Migration(migrations.Migration): 'abstract': False, }, ), - migrations.CreateModel( - name='ScheduleMethod', - fields=[ - ('value', models.CharField(max_length=128, primary_key=True, serialize=False, unique=True)), - ], - options={ - 'abstract': False, - }, - ), migrations.CreateModel( name='SchedulingConstraintsTemplate', fields=[ @@ -602,7 +593,6 @@ class Migration(migrations.Migration): ('stop_time', models.DateTimeField(help_text='Stop this subtask at the specified time (NULLable).', null=True)), ('specifications_doc', django.contrib.postgres.fields.jsonb.JSONField(help_text='Final specifications, as input for the controller.')), ('do_cancel', models.DateTimeField(help_text='Timestamp when the subtask has been ordered to cancel (NULLable).', null=True)), - ('priority', models.IntegerField(help_text='Absolute priority of this subtask (higher value means more important).')), ('raw_feedback', models.CharField(help_text='The raw feedback for this Subtask', max_length=1048576, null=True)), ], options={ @@ -1047,11 +1037,6 @@ class Migration(migrations.Migration): name='global_identifier', field=models.ForeignKey(editable=False, help_text='The global unique identifier for LTA SIP.', null=True, on_delete=django.db.models.deletion.PROTECT, to='tmssapp.SIPidentifier'), ), - migrations.AddField( - model_name='subtask', - name='schedule_method', - field=models.ForeignKey(help_text='Which method to use for scheduling this Subtask. One of (MANUAL, BATCH, DYNAMIC).', on_delete=django.db.models.deletion.PROTECT, to='tmssapp.ScheduleMethod'), - ), migrations.AddField( model_name='subtask', name='specifications_template', diff --git a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py index e23874fc0c9b9b3bf4ed0a0f252ad3ce71c552d7..188b5c3086547549a8f527febaf37f6749044238 100644 --- a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py @@ -93,16 +93,6 @@ class Algorithm(AbstractChoice): AES256 = 'aes256' -class ScheduleMethod(AbstractChoice): - """Defines the model and predefined list of possible Algorithm's for DataproductHash. - The items in the Choices class below are automagically populated into the database via a data migration.""" - - class Choices(Enum): - MANUAL = 'manual' - BATCH = 'batch' - DYNAMIC = 'dynamic' - - # # Templates # @@ -153,8 +143,6 @@ class Subtask(BasicCommon): task_blueprint = ForeignKey('TaskBlueprint', related_name='subtasks', null=True, on_delete=SET_NULL, help_text='Task Blueprint to which this Subtask belongs.') specifications_template = ForeignKey('SubtaskTemplate', null=False, on_delete=PROTECT, help_text='Schema used for specifications_doc.') do_cancel = DateTimeField(null=True, help_text='Timestamp when the subtask has been ordered to cancel (NULLable).') - priority = IntegerField(help_text='Absolute priority of this subtask (higher value means more important).') - schedule_method = ForeignKey('ScheduleMethod', null=False, on_delete=PROTECT, help_text='Which method to use for scheduling this Subtask. One of (MANUAL, BATCH, DYNAMIC).') cluster = ForeignKey('Cluster', null=True, on_delete=PROTECT, help_text='Where the Subtask is scheduled to run (NULLable).') # resource_claim = ForeignKey("ResourceClaim", null=False, on_delete=PROTECT) # todo <-- how is this external reference supposed to work? created_or_updated_by_user = ForeignKey(User, null=True, editable=False, on_delete=PROTECT, help_text='The user who created / updated the subtask.') diff --git a/SAS/TMSS/src/tmss/tmssapp/populate.py b/SAS/TMSS/src/tmss/tmssapp/populate.py index 8c01e33aea2b94287e1b32035a251c25c8003079..09301f45f8484ee2375f8a62383c628dc56b0441 100644 --- a/SAS/TMSS/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/src/tmss/tmssapp/populate.py @@ -35,7 +35,7 @@ def populate_choices(apps, schema_editor): :return: None ''' for choice_class in [Role, Datatype, Dataformat, CopyReason, - SubtaskState, SubtaskType, StationType, Algorithm, ScheduleMethod, SchedulingRelationPlacement, + SubtaskState, SubtaskType, StationType, Algorithm, SchedulingRelationPlacement, Flag, ProjectCategory, PeriodCategory, Quantity, TaskType]: choice_class.objects.bulk_create([choice_class(value=x.value) for x in choice_class.Choices]) diff --git a/SAS/TMSS/src/tmss/tmssapp/serializers/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/serializers/scheduling.py index 85d7bd21c54ca2ad78badd911131847c11fb3375..e70f7585074cf5c87edce6ae0c8d10f7475d712e 100644 --- a/SAS/TMSS/src/tmss/tmssapp/serializers/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/serializers/scheduling.py @@ -40,12 +40,6 @@ class AlgorithmSerializer(RelationalHyperlinkedModelSerializer): fields = '__all__' -class ScheduleMethodSerializer(RelationalHyperlinkedModelSerializer): - class Meta: - model = models.ScheduleMethod - fields = '__all__' - - class SubtaskTemplateSerializer(AbstractTemplateSerializer): class Meta: model = models.SubtaskTemplate diff --git a/SAS/TMSS/src/tmss/tmssapp/subtasks.py b/SAS/TMSS/src/tmss/tmssapp/subtasks.py index dcc07a38b11940e4cb6d07c566b2ffb7302e9d16..881312731f51875057fa4f72457d1efff5207fcf 100644 --- a/SAS/TMSS/src/tmss/tmssapp/subtasks.py +++ b/SAS/TMSS/src/tmss/tmssapp/subtasks.py @@ -249,8 +249,6 @@ def create_observation_control_subtask_from_task_blueprint(task_blueprint: TaskB "task_blueprint": task_blueprint, "specifications_template": subtask_template, "tags": [], - "priority": 1, - "schedule_method": ScheduleMethod.objects.get(value=ScheduleMethod.Choices.DYNAMIC.value), "cluster": Cluster.objects.get(name=cluster_name) } subtask = Subtask.objects.create(**subtask_data) @@ -312,8 +310,6 @@ def create_qafile_subtask_from_observation_subtask(observation_subtask: Subtask) "task_blueprint": observation_subtask.task_blueprint, "specifications_template": qafile_subtask_template, "specifications_doc": qafile_subtask_spec, - "priority": 1, - "schedule_method": ScheduleMethod.objects.get(value=ScheduleMethod.Choices.DYNAMIC.value), "cluster": observation_subtask.cluster} qafile_subtask = Subtask.objects.create(**qafile_subtask_data) @@ -376,8 +372,6 @@ def create_qaplots_subtask_from_qafile_subtask(qafile_subtask: Subtask) -> Subta "task_blueprint": qafile_subtask.task_blueprint, "specifications_template": qaplots_subtask_template, "specifications_doc": qaplots_subtask_spec_doc, - "priority": 1, - "schedule_method": ScheduleMethod.objects.get(value=ScheduleMethod.Choices.DYNAMIC.value), "cluster": qafile_subtask.cluster} qaplots_subtask = Subtask.objects.create(**qaplots_subtask_data) @@ -423,8 +417,6 @@ def create_preprocessing_subtask_from_task_blueprint(task_blueprint: TaskBluepri "task_blueprint": task_blueprint, "specifications_template": subtask_template, "specifications_doc": subtask_specs, - "priority": 1, - "schedule_method": ScheduleMethod.objects.get(value=ScheduleMethod.Choices.DYNAMIC.value), "cluster": Cluster.objects.get(name=cluster_name) } subtask = Subtask.objects.create(**subtask_data) @@ -469,8 +461,6 @@ def create_ingest_subtask_from_task_blueprint(task_blueprint: TaskBlueprint) -> "task_blueprint": task_blueprint, "specifications_template": subtask_template, "specifications_doc": subtask_specs, - "priority": 1, - "schedule_method": ScheduleMethod.objects.get(value=ScheduleMethod.Choices.DYNAMIC.value), "cluster": Cluster.objects.get(name=cluster_name)} subtask = Subtask.objects.create(**subtask_data) diff --git a/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py index 9883d4058ddd4a16a6a84fe0bd49cde7f857a00f..bcd3eaf22671451c5d005e36c178c56f66b1c0f3 100644 --- a/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py @@ -77,10 +77,6 @@ class AlgorithmViewSet(LOFARViewSet): queryset = models.Algorithm.objects.all() serializer_class = serializers.AlgorithmSerializer -class ScheduleMethodViewSet(LOFARViewSet): - queryset = models.ScheduleMethod.objects.all() - serializer_class = serializers.ScheduleMethodSerializer - class SubtaskTemplateFilter(filters.FilterSet): class Meta: model = models.SubtaskTemplate @@ -144,7 +140,7 @@ class SubtaskViewSet(LOFARViewSet): ordering = ('start_time',) # performance boost: select the related models in a single db call. - queryset = queryset.select_related('state', 'specifications_template', 'specifications_template__type', 'schedule_method', 'cluster', 'created_or_updated_by_user') + queryset = queryset.select_related('state', 'specifications_template', 'specifications_template__type', 'cluster', 'created_or_updated_by_user') @swagger_auto_schema(auto_schema=TextPlainAutoSchema, responses={200: 'A LOFAR parset for this subtask (as plain text)', @@ -292,7 +288,7 @@ class SubtaskNestedViewSet(LOFARNestedViewSet): ordering = ('start_time',) # performance boost: select the related models in a single db call. - queryset = queryset.select_related('state', 'specifications_template', 'specifications_template__type', 'schedule_method', 'cluster', 'created_or_updated_by_user') + queryset = queryset.select_related('state', 'specifications_template', 'specifications_template__type', 'cluster', 'created_or_updated_by_user') def get_queryset(self): if 'task_blueprint_id' in self.kwargs: diff --git a/SAS/TMSS/src/tmss/urls.py b/SAS/TMSS/src/tmss/urls.py index 89bc10dc4e405a19f8a56218238a6078c6824f88..1327d5b5a41ba2e80d100c254ef60c7ddc91aa0b 100644 --- a/SAS/TMSS/src/tmss/urls.py +++ b/SAS/TMSS/src/tmss/urls.py @@ -174,7 +174,6 @@ router.register(r'subtask_state', viewsets.SubtaskStateViewSet) router.register(r'subtask_type', viewsets.SubtaskTypeViewSet) router.register(r'station_type', viewsets.StationTypeViewSet) router.register(r'algorithm', viewsets.AlgorithmViewSet) -router.register(r'schedule_method', viewsets.ScheduleMethodViewSet) router.register(r'scheduling_relation_placement', viewsets.SchedulingRelationPlacement) # templates diff --git a/SAS/TMSS/test/testdata/subtasks.json b/SAS/TMSS/test/testdata/subtasks.json index 70f8b97d95e9c2c830bcc42092bcf0144a506f9e..2596021102cda14054c339f651d9b7c0c0eb7a55 100644 --- a/SAS/TMSS/test/testdata/subtasks.json +++ b/SAS/TMSS/test/testdata/subtasks.json @@ -31,11 +31,9 @@ "stop_time": "2020-01-02T12:00:00", "specifications_doc": 1, "do_cancel": null, - "priority": 1, "state": "defined", "task_blueprint": null, "specifications_template": 1, - "schedule_method": "manual", "cluster": 2, "tags": [ "loaded by fixture", "TMSS-154", "manual testing" ], "created_at": "2020-02-24T13:19:57", @@ -50,11 +48,9 @@ "stop_time": "2020-01-03T12:00:00", "specifications_doc": 1, "do_cancel": null, - "priority": 1, "state": "defined", "task_blueprint": null, "specifications_template": 1, - "schedule_method": "manual", "cluster": 3, "tags": [ "loaded by fixture", "TMSS-154", "manual testing" ], "created_at": "2020-02-24T13:19:57", @@ -69,11 +65,9 @@ "stop_time": "2020-01-04T12:00:00", "specifications_doc": 1, "do_cancel": null, - "priority": 1, "state": "defined", "task_blueprint": null, "specifications_template": 1, - "schedule_method": "manual", "cluster": 1, "tags": [ "loaded by fixture", "TMSS-154", "manual testing" ], "created_at": "2020-02-24T13:19:57", diff --git a/SAS/TMSS/test/tmss_test_data_django_models.py b/SAS/TMSS/test/tmss_test_data_django_models.py index f81730d7ad87639e580589eb93fdab46a568a3df..5edc2d0b9a87be9a108937fb0467fdff1476860d 100644 --- a/SAS/TMSS/test/tmss_test_data_django_models.py +++ b/SAS/TMSS/test/tmss_test_data_django_models.py @@ -384,8 +384,6 @@ def Subtask_test_data(task_blueprint: models.TaskBlueprint=None, subtask_templat "specifications_template": subtask_template, "tags": ["TMSS", "TESTING"], "do_cancel": datetime.utcnow(), - "priority": 1, - "schedule_method": models.ScheduleMethod.objects.get(value='manual'), "cluster": cluster, "raw_feedback": raw_feedback} diff --git a/SAS/TMSS/test/tmss_test_data_rest.py b/SAS/TMSS/test/tmss_test_data_rest.py index 8f63cc455ea4110c9c00eed5adb8d209b37e64fd..1a16d480f10c74cd783b3ea88d39fd363b1c2cfc 100644 --- a/SAS/TMSS/test/tmss_test_data_rest.py +++ b/SAS/TMSS/test/tmss_test_data_rest.py @@ -517,8 +517,6 @@ class TMSSRESTTestDataCreator(): "specifications_template": specifications_template_url, "tags": ["TMSS", "TESTING"], "do_cancel": datetime.utcnow().isoformat(), - "priority": 1, - "schedule_method": self.django_api_url + '/schedule_method/manual', "cluster": cluster_url, "raw_feedback": raw_feedack}