diff --git a/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py b/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py index 9922728c7861b4c3091dba033fe1ec2bbdb77740..d2562d2f2d5b4156d7a81cea9d9d62139f49cc61 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py +++ b/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py @@ -537,11 +537,11 @@ def compute_scheduling_unit_scores(scheduling_unit: models.SchedulingUnitBluepri 'time': 1.0, 'daily': 1.0 } - # add individual scheduling_unit priority_rank - scores['scheduling_unit_priority_rank'] = scheduling_unit.priority_rank + # add individual scheduling_unit rank + scores['scheduling_unit_rank'] = scheduling_unit.rank # add "common" scores which do not depend on constraints, such as project rank and creation date - scores['project_rank'] = scheduling_unit.project.priority_rank + scores['rank'] = scheduling_unit.project.rank scores['age'] = (datetime.utcnow() - scheduling_unit.created_at).total_seconds() earliest_possible_start_time = get_earliest_possible_start_time(scheduling_unit, lower_bound) diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py index c063fef88d3a3e4ccf54b0b9d2cdde999e58531c..6de497892f9befcd4bb62c6a55fded310e1fc585 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py @@ -544,7 +544,7 @@ class TMSSDynamicSchedulingMessageHandler(TMSSEventMessageHandler): def onSchedulingUnitBlueprintConstraintsUpdated(self, id: int, scheduling_constraints_doc: dict): self.onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(id) - def onSchedulingUnitBlueprintPriorityRankUpdated(self, id: int, priority_rank: float): + def onSchedulingUnitBlueprintRankUpdated(self, id: int, rank: float): self.onSchedulingUnitBlueprintConstraintsRankOrQueueUpdated(id) def onSchedulingUnitBlueprintPriorityQueueUpdated(self, id: int, priority_queue: str): @@ -608,8 +608,8 @@ class TMSSDynamicSchedulingMessageHandler(TMSSEventMessageHandler): self.scheduler.trigger() - def onProjectPriorityRankUpdated(self, name: str, priority_rank: float): - logger.info("project '%s' priority_rank changed to %s", name, priority_rank) + def onProjectRankUpdated(self, name: str, rank: float): + logger.info("project '%s' rank changed to %s", name, rank) self.scheduler.trigger() diff --git a/SAS/TMSS/backend/services/scheduling/test/t_dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/test/t_dynamic_scheduling.py index fee5838d442e85785842ac408187f7182375a995..8e28ffb00af13ffc535760114e72f89073c3d02e 100755 --- a/SAS/TMSS/backend/services/scheduling/test/t_dynamic_scheduling.py +++ b/SAS/TMSS/backend/services/scheduling/test/t_dynamic_scheduling.py @@ -76,9 +76,9 @@ class BaseDynamicSchedulingTestCase(unittest.TestCase): def setUpClass(cls) -> None: super().setUpClass() # make some re-usable projects with high/low priority - cls.project_low = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), priority_rank=1)) - cls.project_medium = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), priority_rank=2)) - cls.project_high = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), priority_rank=3)) + cls.project_low = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), rank=1)) + cls.project_medium = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), rank=2)) + cls.project_high = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), rank=3)) cls.scheduling_set_low = models.SchedulingSet.objects.create(**SchedulingSet_test_data(project=cls.project_low)) cls.scheduling_set_medium = models.SchedulingSet.objects.create(**SchedulingSet_test_data(project=cls.project_medium)) cls.scheduling_set_high = models.SchedulingSet.objects.create(**SchedulingSet_test_data(project=cls.project_high)) @@ -138,7 +138,7 @@ class BaseDynamicSchedulingTestCase(unittest.TestCase): scheduling_constraints_template=constraints_template, interrupts_telescope=interrupts_telescope, priority_queue=priority_queue, - priority_rank=unit_priority) + rank=unit_priority) scheduling_unit_draft = update_task_graph_from_specifications_doc(scheduling_unit_draft, scheduling_unit_spec) return scheduling_unit_draft @@ -915,7 +915,7 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): for queue in (queue_B, queue_A): for scheduling_set in (self.scheduling_set_low, self.scheduling_set_medium, self.scheduling_set_high): for unit_prio in (0.9, 1.0): - scheduling_unit_draft = self.create_simple_observation_scheduling_unit('SU queue=%s project_prio=%s unit_prio=%s' % (queue.value, scheduling_set.project.priority_rank, unit_prio), + scheduling_unit_draft = self.create_simple_observation_scheduling_unit('SU queue=%s project_prio=%s unit_prio=%s' % (queue.value, scheduling_set.project.rank, unit_prio), scheduling_set=scheduling_set, priority_queue=queue, unit_priority=unit_prio) @@ -952,7 +952,7 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): self.assertEqual(expected_project, scheduled_scheduling_unit.project) # check that within a queue, and equal project priority, the unit priority takes precedence - self.assertAlmostEqual(expected_unit_prio, scheduled_scheduling_unit.priority_rank, 2) + self.assertAlmostEqual(expected_unit_prio, scheduled_scheduling_unit.rank, 2) # check that we are scheduled after the previous one if prev_scheduled_scheduling_unit is not None: @@ -975,9 +975,9 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): constraints_template = models.SchedulingConstraintsTemplate.objects.get(name="constraints", version=1) # start with weight su_prio=0 and project_prio=0.9 - wf_scheduling_unit_priority_rank, created = models.SchedulingConstraintsWeightFactor.objects.get_or_create(scheduling_constraints_template=constraints_template, constraint_name="scheduling_unit_priority_rank") - wf_scheduling_unit_priority_rank.weight = 0 - wf_scheduling_unit_priority_rank.save() + wf_scheduling_unit_rank, created = models.SchedulingConstraintsWeightFactor.objects.get_or_create(scheduling_constraints_template=constraints_template, constraint_name="scheduling_unit_rank") + wf_scheduling_unit_rank.weight = 0 + wf_scheduling_unit_rank.save() wf_project_rank, created = models.SchedulingConstraintsWeightFactor.objects.get_or_create(scheduling_constraints_template=constraints_template, constraint_name="project_rank") wf_project_rank.weight = 0.9 @@ -987,9 +987,9 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): for scheduling_set in (self.scheduling_set_high, self.scheduling_set_medium): project = scheduling_set.project # 'invert' the unit_prio in comparison to project - unit_prio = self.project_medium.priority_rank if project==self.project_high else self.project_high.priority_rank + unit_prio = self.project_medium.rank if project==self.project_high else self.project_high.rank - scheduling_unit_draft = self.create_simple_observation_scheduling_unit('SU project_prio=%s unit_prio=%s' % (project.priority_rank, unit_prio), + scheduling_unit_draft = self.create_simple_observation_scheduling_unit('SU project_prio=%s unit_prio=%s' % (project.rank, unit_prio), scheduling_set=scheduling_set, unit_priority=unit_prio, ) @@ -1016,8 +1016,8 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): self.assertEqual(models.SchedulingUnitStatus.Choices.SCHEDULED.value, scheduled_unit_blueprint.status.value) # change the weightfactors (swap them compared to above) - wf_scheduling_unit_priority_rank.weight = 1 - wf_scheduling_unit_priority_rank.save() + wf_scheduling_unit_rank.weight = 1 + wf_scheduling_unit_rank.save() wf_project_rank.weight = 0 wf_project_rank.save() @@ -1030,15 +1030,15 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): self.assertEqual(models.SchedulingUnitStatus.Choices.SCHEDULED.value, scheduled_unit_blueprint.status.value) - def test_scheduling_unit_priority_rank(self): + def test_scheduling_unit_rank(self): """ - When all other constraints/priorities/queues are equal, the scheduling_unit's individual priority_rank should determine the order. + When all other constraints/priorities/queues are equal, the scheduling_unit's individual rank should determine the order. """ LOW_RANK = 500 HIGH_RANK = 1000 - for priority_rank in (LOW_RANK, HIGH_RANK): - scheduling_unit_draft = self.create_simple_observation_scheduling_unit('scheduling_unit priority_rank=%s' % (priority_rank,), scheduling_set=self.scheduling_set_low) - scheduling_unit_draft.priority_rank = priority_rank + for rank in (LOW_RANK, HIGH_RANK): + scheduling_unit_draft = self.create_simple_observation_scheduling_unit('scheduling_unit rank=%s' % (rank,), scheduling_set=self.scheduling_set_low) + scheduling_unit_draft.rank = rank scheduling_unit_draft.save() scheduling_unit_blueprint = create_scheduling_unit_blueprint_and_tasks_and_subtasks_from_scheduling_unit_draft(scheduling_unit_draft) @@ -1046,18 +1046,18 @@ class TestDynamicScheduling(BaseDynamicSchedulingTestCase): scheduling_unit_blueprint.scheduling_constraints_doc = {'scheduler': 'dynamic'} scheduling_unit_blueprint.save() - self.assertEqual(scheduling_unit_draft.priority_rank, scheduling_unit_blueprint.priority_rank) + self.assertEqual(scheduling_unit_draft.rank, scheduling_unit_blueprint.rank) scheduled_scheduling_unit = self.scheduler.do_dynamic_schedule() self.assertIsNotNone(scheduled_scheduling_unit) self.assertEqual(scheduled_scheduling_unit.status.value, 'scheduled') - self.assertEqual(HIGH_RANK, scheduled_scheduling_unit.priority_rank) + self.assertEqual(HIGH_RANK, scheduled_scheduling_unit.rank) cancel_scheduling_unit_blueprint(scheduled_scheduling_unit) scheduled_scheduling_unit = self.scheduler.do_dynamic_schedule() self.assertIsNotNone(scheduled_scheduling_unit) self.assertEqual(scheduled_scheduling_unit.status.value, 'scheduled') - self.assertEqual(LOW_RANK, scheduled_scheduling_unit.priority_rank) + self.assertEqual(LOW_RANK, scheduled_scheduling_unit.rank) def test_fixed_time_constraint_is_preventing_scheduling_unit_from_being_scheduled_dynamically(self): diff --git a/SAS/TMSS/backend/services/scheduling/test/t_scheduling_constraints.py b/SAS/TMSS/backend/services/scheduling/test/t_scheduling_constraints.py index a87f4c96e0a2307698372cd2ee7182cab6b5e622..68c7f0ba75c2fd4a9febc839950154bd5d3db549 100755 --- a/SAS/TMSS/backend/services/scheduling/test/t_scheduling_constraints.py +++ b/SAS/TMSS/backend/services/scheduling/test/t_scheduling_constraints.py @@ -76,7 +76,7 @@ class BaseSchedulingConstraintsTestCase(unittest.TestCase): def setUpClass(cls) -> None: super().setUpClass() # make some re-usable projects with high/low priority - cls.project = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), priority_rank=3)) + cls.project = models.Project.objects.create(**Project_test_data("dynamic scheduling test project %s"% (uuid.uuid4(),), rank=3)) cls.scheduling_set = models.SchedulingSet.objects.create(**SchedulingSet_test_data(project=cls.project)) cls.scheduler = Scheduler() diff --git a/SAS/TMSS/backend/services/tmss_postgres_listener/lib/tmss_postgres_listener.py b/SAS/TMSS/backend/services/tmss_postgres_listener/lib/tmss_postgres_listener.py index baf9c8c969bb841182acaec3054821f65cac2169..780e098a8f9fb74fa25117add26438beda9e1853 100644 --- a/SAS/TMSS/backend/services/tmss_postgres_listener/lib/tmss_postgres_listener.py +++ b/SAS/TMSS/backend/services/tmss_postgres_listener/lib/tmss_postgres_listener.py @@ -123,8 +123,8 @@ class TMSSPGListener(PostgresListener): self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_schedulingunitblueprint', 'update', column_name='priority_queue_id', quote_column_value=True)) self.subscribe('tmssapp_schedulingunitblueprint_update_priority_queue_id', self.onSchedulingUnitBlueprintPriorityQueueUpdated) - self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_schedulingunitblueprint', 'update', column_name='priority_rank', quote_column_value=False)) - self.subscribe('tmssapp_schedulingunitblueprint_update_priority_rank', self.onSchedulingUnitBlueprintPriorityRankUpdated) + self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_schedulingunitblueprint', 'update', column_name='rank', quote_column_value=False)) + self.subscribe('tmssapp_schedulingunitblueprint_update_rank', self.onSchedulingUnitBlueprintRankUpdated) # SchedulingConstraintsWeightFactor @@ -159,8 +159,8 @@ class TMSSPGListener(PostgresListener): self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_project', 'update', id_column_name="name", quote_id_value=True, column_name='project_state_id', quote_column_value=True)) self.subscribe('tmssapp_project_update_project_state_id', self.onProjectStatusUpdated) - self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_project', 'update', id_column_name="name", quote_id_value=True, column_name='priority_rank', quote_column_value=False)) - self.subscribe('tmssapp_project_update_priority_rank', self.onProjectPriorityRankUpdated) + self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_project', 'update', id_column_name="name", quote_id_value=True, column_name='rank', quote_column_value=False)) + self.subscribe('tmssapp_project_update_rank', self.onProjectRankUpdated) # ProjectQuotaArchiveLocation self.executeQuery(makePostgresNotificationQueries('', 'tmssapp_projectquotaarchivelocation', 'insert')) @@ -273,8 +273,8 @@ class TMSSPGListener(PostgresListener): def onSchedulingUnitBlueprintIngestPermissionGranted(self, payload=None): self._sendNotification(TMSS_SCHEDULINGUNITBLUEPRINT_OBJECT_EVENT_PREFIX + '.IngestPermissionGranted', payload) - def onSchedulingUnitBlueprintPriorityRankUpdated(self, payload=None): - self._sendNotification(TMSS_SCHEDULINGUNITBLUEPRINT_OBJECT_EVENT_PREFIX + '.PriorityRank.Updated', payload) + def onSchedulingUnitBlueprintRankUpdated(self, payload=None): + self._sendNotification(TMSS_SCHEDULINGUNITBLUEPRINT_OBJECT_EVENT_PREFIX + '.Rank.Updated', payload) def onSchedulingUnitBlueprintPriorityQueueUpdated(self, payload=None): payload_dict = json.loads(payload) @@ -317,8 +317,8 @@ class TMSSPGListener(PostgresListener): self._sendNotification(TMSS_PROJECT_STATUS_EVENT_PREFIX+'.'+project_status.capitalize(), {'name': project_name, 'status': project_status}) - def onProjectPriorityRankUpdated(self, payload = None): - self._sendNotification(TMSS_PROJECT_OBJECT_EVENT_PREFIX+'.PriorityRank.Updated', payload) + def onProjectRankUpdated(self, payload = None): + self._sendNotification(TMSS_PROJECT_OBJECT_EVENT_PREFIX+'.Rank.Updated', payload) def onProjectQuotaArchiveLocationInserted(self, payload = None): diff --git a/SAS/TMSS/backend/src/migrate_momdb_to_tmss.py b/SAS/TMSS/backend/src/migrate_momdb_to_tmss.py index 3b4103e3a6be537be4b39da6f4aac669fb0edad6..2cbb910899f45d925c1302b0a5b65330851a952f 100755 --- a/SAS/TMSS/backend/src/migrate_momdb_to_tmss.py +++ b/SAS/TMSS/backend/src/migrate_momdb_to_tmss.py @@ -204,7 +204,7 @@ def get_project_details_from_momdb(): details = {"name": mom_details['name'], "description": "" if not mom_details['description'] else mom_details['description'], "tags": ["migrated_from_MoM", "migration_incomplete"], - "priority_rank": mom_details['priority'], + "rank": mom_details['priority'], "trigger_priority": 1000, "can_trigger": mom_details['allowtriggers'], "private_data": True, # todo: check project.releasedate and compare to now or how to determine??? @@ -507,7 +507,7 @@ def create_subtask_trees_for_project_in_momdb(project_mom2id, project): #"task_blueprint": task_blueprint, # ManyToMany, use set() "specifications_template": specifications_template, "tags": ["migrated_from_MoM", "migration_incomplete"], # todo: set complete once it is verified that all info is present - "priority": project.priority_rank, # todo: correct to derive from project? + "priority": project.rank, # todo: correct to derive from project? # optional: "scheduled_start_time": start_time, "scheduled_stop_time": stop_time diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py index fdd3e437daba20e569f86b7b82e6355b52e61e35..fdcdf6b0f89671243f5aa6184b08a9d15e022884 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py @@ -473,6 +473,7 @@ def populate_cycles(apps, schema_editor): def populate_projects(apps, schema_editor): + return 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,), diff --git a/SAS/TMSS/backend/test/t_tasks.py b/SAS/TMSS/backend/test/t_tasks.py index d733b2e6c128177bf355b15ba8ba9adfec1f6aa3..88851d9227aa9f4c5c880608c105298e0bd7f7ec 100755 --- a/SAS/TMSS/backend/test/t_tasks.py +++ b/SAS/TMSS/backend/test/t_tasks.py @@ -76,7 +76,7 @@ class CreationFromSchedulingUnitDraft(unittest.TestCase): ingest_permission_required=False, piggyback_allowed_tbb=True, piggyback_allowed_aartfaac=True, - priority_rank=0.25, + rank=0.25, interrupts_telescope=False) update_task_graph_from_specifications_doc(scheduling_unit_draft, strategy_template.template) @@ -86,7 +86,7 @@ class CreationFromSchedulingUnitDraft(unittest.TestCase): self.assertEqual(scheduling_unit_draft.ingest_permission_required, scheduling_unit_blueprint.ingest_permission_required) self.assertEqual(scheduling_unit_draft.piggyback_allowed_tbb, scheduling_unit_blueprint.piggyback_allowed_tbb) self.assertEqual(scheduling_unit_draft.piggyback_allowed_aartfaac, scheduling_unit_blueprint.piggyback_allowed_aartfaac) - self.assertEqual(scheduling_unit_draft.priority_rank, scheduling_unit_blueprint.priority_rank) + self.assertEqual(scheduling_unit_draft.rank, scheduling_unit_blueprint.rank) self.assertEqual(scheduling_unit_draft.interrupts_telescope, scheduling_unit_blueprint.interrupts_telescope) def test_create_task_drafts_from_scheduling_unit_draft(self): @@ -152,7 +152,7 @@ class CreationFromSchedulingUnitDraft(unittest.TestCase): ingest_permission_required=True, piggyback_allowed_tbb=False, piggyback_allowed_aartfaac=False, - priority_rank=0.19, + rank=0.19, interrupts_telescope=False) update_task_graph_from_specifications_doc(scheduling_unit_draft, strategy_template.template) @@ -162,7 +162,7 @@ class CreationFromSchedulingUnitDraft(unittest.TestCase): self.assertEqual(scheduling_unit_draft.ingest_permission_required, scheduling_unit_blueprint.ingest_permission_required) self.assertEqual(scheduling_unit_draft.piggyback_allowed_tbb, scheduling_unit_blueprint.piggyback_allowed_tbb) self.assertEqual(scheduling_unit_draft.piggyback_allowed_aartfaac, scheduling_unit_blueprint.piggyback_allowed_aartfaac) - self.assertEqual(scheduling_unit_draft.priority_rank, scheduling_unit_blueprint.priority_rank) + self.assertEqual(scheduling_unit_draft.rank, scheduling_unit_blueprint.rank) self.assertEqual(scheduling_unit_draft.interrupts_telescope, scheduling_unit_blueprint.interrupts_telescope) diff --git a/SAS/TMSS/backend/test/t_tmssapp_specification_REST_API.py b/SAS/TMSS/backend/test/t_tmssapp_specification_REST_API.py index aebb17dfa1434f32fc501d8c30ea4f3bce8c2c12..2e77f49f13af7ed27faabc555b26f288722332f3 100755 --- a/SAS/TMSS/backend/test/t_tmssapp_specification_REST_API.py +++ b/SAS/TMSS/backend/test/t_tmssapp_specification_REST_API.py @@ -786,7 +786,7 @@ class ProjectTestCase(unittest.TestCase): url = r_dict['url'] GET_OK_and_assert_equal_expected_response(self, url, expected) - test_patch = {"priority_rank": 1.0, + test_patch = {"rank": 1.0, "tags": ["SUPERIMPORTANT"]} # PATCH item and verify @@ -1318,18 +1318,18 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): self.assertEqual(response_2['results'][1]['name'], su_draft_3.name) self.assertIn('Select a valid choice', str(response_3)) - def test_GET_SchedulingUnitDraft_view_filters_for_priority_rank(self): + def test_GET_SchedulingUnitDraft_view_filters_for_rank(self): """ Test we can filter on this property, which is explicitly named on the model-specific property filter """ # setup - su_draft_1 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud1_%s' % uuid.uuid4()), priority_rank=0.111) - su_draft_2 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud2_%s' % uuid.uuid4()), priority_rank=0.222) - su_draft_3 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud3_%s' % uuid.uuid4()), priority_rank=0.333) + su_draft_1 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud1_%s' % uuid.uuid4()), rank=0.111) + su_draft_2 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud2_%s' % uuid.uuid4()), rank=0.222) + su_draft_3 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data(name='sud3_%s' % uuid.uuid4()), rank=0.333) # assert - response_1 = GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/?priority_rank_min=%s&priority_rank_max=%s' % (0.110, 0.112), 200) - response_2 = GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/?priority_rank_min=%s&priority_rank_max=%s' % (0.2, 0.4), 200) + response_1 = GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/?rank_min=%s&rank_max=%s' % (0.110, 0.112), 200) + response_2 = GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/?rank_min=%s&rank_max=%s' % (0.2, 0.4), 200) self.assertEqual(response_1['count'], 1) self.assertEqual(response_1['results'][0]['name'], su_draft_1.name) diff --git a/SAS/TMSS/backend/test/tmss_test_data_django_models.py b/SAS/TMSS/backend/test/tmss_test_data_django_models.py index a5ce8233401eceee38183665dda69f9f7033e6bd..e18db900118a4d168af571ecf023f92925a413df 100644 --- a/SAS/TMSS/backend/test/tmss_test_data_django_models.py +++ b/SAS/TMSS/backend/test/tmss_test_data_django_models.py @@ -112,7 +112,7 @@ def Cycle_test_data(start=None, stop=None) -> dict: "start": start or datetime.utcnow().isoformat(), "stop": stop or datetime.utcnow().isoformat()} -def Project_test_data(name: str=None, priority_rank: int = 1, auto_pin=False, can_trigger=False, auto_ingest=False, project_state=None) -> dict: +def Project_test_data(name: str=None, rank: int = 1, auto_pin=False, can_trigger=False, auto_ingest=False, project_state=None) -> dict: if name is None: name = 'my_project_' + str(uuid.uuid4()) @@ -124,7 +124,7 @@ def Project_test_data(name: str=None, priority_rank: int = 1, auto_pin=False, ca "description": 'my description ' + str(uuid.uuid4()), "tags": [], "auto_ingest": False, - "priority_rank": priority_rank, + "rank": rank, "trigger_priority": 1000, "can_trigger": can_trigger, "private_data": True, diff --git a/SAS/TMSS/backend/test/tmss_test_data_rest.py b/SAS/TMSS/backend/test/tmss_test_data_rest.py index 7592d0fdd05e64a21cda275db9fcc3902c36c5b3..f32b2640bb6a8fd320b3c560a451e18a4461c0b0 100644 --- a/SAS/TMSS/backend/test/tmss_test_data_rest.py +++ b/SAS/TMSS/backend/test/tmss_test_data_rest.py @@ -255,7 +255,7 @@ class TMSSRESTTestDataCreator(): "description": description, "tags": [], "quota": [], - "priority_rank": 1.0, + "rank": 1.0, "trigger_priority": 1000, "can_trigger": False, "private_data": True, diff --git a/SAS/TMSS/client/lib/tmssbuslistener.py b/SAS/TMSS/client/lib/tmssbuslistener.py index fde71938060082baa3d70862da5c42acaf5a5a21..c6d8772d20b4c52d2da6eddd2885406dc38ce7fc 100644 --- a/SAS/TMSS/client/lib/tmssbuslistener.py +++ b/SAS/TMSS/client/lib/tmssbuslistener.py @@ -128,8 +128,8 @@ class TMSSEventMessageHandler(AbstractMessageHandler): self.onProjectStatusUpdated(**msg.content) elif stripped_subject == 'Project.Object.Deleted': self.onProjectDeleted(**msg.content) - elif stripped_subject == 'Project.Object.PriorityRank.Updated': - self.onProjectPriorityRankUpdated(**msg.content) + elif stripped_subject == 'Project.Object.Rank.Updated': + self.onProjectRankUpdated(**msg.content) elif stripped_subject == 'ProjectQuotaArchiveLocation.Object.Created': self.onProjectQuotaArchiveLocationCreated(**msg.content) elif stripped_subject == 'ProjectQuotaArchiveLocation.Object.Updated': @@ -140,8 +140,8 @@ class TMSSEventMessageHandler(AbstractMessageHandler): self.onSchedulingUnitBlueprintCannotProceed(**msg.content) elif stripped_subject == 'SchedulingUnitBlueprint.Object.Constraints.Updated': self.onSchedulingUnitBlueprintConstraintsUpdated(**msg.content) - elif stripped_subject == 'SchedulingUnitBlueprint.Object.PriorityRank.Updated': - self.onSchedulingUnitBlueprintPriorityRankUpdated(**msg.content) + elif stripped_subject == 'SchedulingUnitBlueprint.Object.Rank.Updated': + self.onSchedulingUnitBlueprintRankUpdated(**msg.content) elif stripped_subject == 'SchedulingUnitBlueprint.Object.PriorityQueue.Updated': self.onSchedulingUnitBlueprintPriorityQueueUpdated(**msg.content) elif stripped_subject == 'SchedulingUnitBlueprint.Object.IngestPermissionGranted': @@ -258,8 +258,8 @@ class TMSSEventMessageHandler(AbstractMessageHandler): ''' pass - def onSchedulingUnitBlueprintPriorityRankUpdated(self, id: int, priority_rank: float): - '''onSchedulingUnitBlueprintPriorityRankUpdated is called upon receiving a SchedulingUnitBlueprint.Object.PriorityRank.Updated message, which is sent when a the priority_rank on a SchedulingUnitDrafts was updated. + def onSchedulingUnitBlueprintRankUpdated(self, id: int, rank: float): + '''onSchedulingUnitBlueprintRankUpdated is called upon receiving a SchedulingUnitBlueprint.Object.Rank.Updated message, which is sent when a the rank on a SchedulingUnitDrafts was updated. :param id: the TMSS id of the SchedulingUnitBlueprint ''' pass @@ -309,8 +309,8 @@ class TMSSEventMessageHandler(AbstractMessageHandler): ''' pass - def onProjectPriorityRankUpdated(self, name: str, priority_rank: float): - '''onProjectPriorityRankUpdated is called upon receiving a Project.PriorityRank.Updated message, which is sent when a Project was assigned a new priority_rank. + def onProjectRankUpdated(self, name: str, rank: float): + '''onProjectRankUpdated is called upon receiving a Project.Rank.Updated message, which is sent when a Project was assigned a new rank. ''' pass diff --git a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js index 114b35b7085b8cb2a3ab809696635554697f319d..a2ea770433ced053c33ecb664e6ba0482e34d746 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js @@ -119,7 +119,7 @@ const ProjectServiceMock= { "filler": false, "period_category": "Single Cycle", "period_category_value": "Single Cycle", - "priority_rank": 5, + "rank": 5, "private_data": true, "project_category": "Regular", "project_category_value": "Regular", @@ -238,7 +238,7 @@ const ProjectServiceMock= { "filler": false, "period_category": "http://192.168.99.100:8008/api/period_category/single_cycle", "period_category_value": "single_cycle", - "priority_rank": 1, + "rank": 1, "private_data": true, "project_category": "http://192.168.99.100:8008/api/project_category/regular", "project_category_value": "regular", @@ -276,7 +276,7 @@ const ProjectServiceMock= { "filler": false, "period_category": null, "period_category_value": null, - "priority_rank": 1, + "rank": 1, "private_data": true, "project_category": null, "project_category_value": null, @@ -318,7 +318,7 @@ const ProjectServiceMock= { "filler": false, "period_category": null, "period_category_value": null, - "priority_rank": 1, + "rank": 1, "private_data": true, "project_category": null, "project_category_value": null, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js index 4321d01a2990058e6316fa6c7491fd41328e1bcd..27aedebc906232c05497768503124081b0b8541a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js @@ -1417,7 +1417,7 @@ function NumberRangeFilter({ ) } -// Priority Rank Range Filter +// Rank Range Filter function RankRangeFilter({ column: { filterValue = [], preFilteredRows, setFilter, id, Header }, }) { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js index 04ef8a71c1ce8c653120f7279022be4ac2bc5a3c..9492e7047e00c6d546575fca7773e83593c2846b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js @@ -39,7 +39,7 @@ export class ProjectCreate extends Component { name: '', description: '', trigger_priority: 1000, - priority_rank: '', + rank: '', quota: [], // Mandatory Field in the back end, so an empty array is passed can_trigger: false, auto_pin: false, @@ -63,7 +63,7 @@ export class ProjectCreate extends Component { this.formRules = { name: {required: true, message: "Name can not be empty"}, description: {required: true, message: "Description can not be empty"}, - priority_rank: {required: true, message: "Enter Project Rank. Min-0.00, Max-6.00"}, + rank: {required: true, message: "Enter Project Rank. Min-0.00, Max-6.00"}, }; this.defaultResourcesEnabled = true; // This property and functionality to be concluded based on PO input this.defaultResources = [{name:'LOFAR Observing Time'}, @@ -209,7 +209,7 @@ export class ProjectCreate extends Component { break; } case 'DECIMAL': { - const previousValue = this.state.project.priority_rank; + const previousValue = this.state.project.rank; value = value.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,2})?)/g.exec(value); const val = match[1] + match[2]; @@ -297,9 +297,9 @@ export class ProjectCreate extends Component { const rule = this.formRules[fieldName]; const fieldValue = this.state.project[fieldName]; if (rule.required) { - if (!fieldValue && fieldName !== 'priority_rank') { + if (!fieldValue && fieldName !== 'rank') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; - } else if (fieldName === 'priority_rank' && fieldValue === '') { + } else if (fieldName === 'rank' && fieldValue === '') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; } else { validFields[fieldName] = true; @@ -344,7 +344,7 @@ export class ProjectCreate extends Component { } } let project = { ...this.state.project }; - project['priority_rank'] = project.priority_rank.toFixed(2); + project['rank'] = project.rank.toFixed(2); ProjectService.saveProject(project, this.defaultResourcesEnabled?projectQuota:[]) .then(project => { if (project.url) { @@ -417,7 +417,7 @@ export class ProjectCreate extends Component { name: '', description: '', trigger_priority: 1000, - priority_rank: 0, + rank: 0, quota: [], archive_location: null, archive_subdirectory:"", @@ -544,11 +544,11 @@ export class ProjectCreate extends Component { data-tip="Priority of this project w.r.t. other projects. Projects can interrupt observations of lower-priority projects. Min-0.00, Max-6.00" inputId="proj-rank" name="rank" data-testid="rank" className="p-inputtext p-component" - value={this.state.project.priority_rank} + value={this.state.project.rank} step="0.01" - onChange={(e)=> this.setProjectParams('priority_rank', e.target.value, "DECIMAL")}/> + onChange={(e)=> this.setProjectParams('rank', e.target.value, "DECIMAL")}/> <label className="error"> - {this.state.errors.priority_rank ? this.state.errors.priority_rank : ""} + {this.state.errors.rank ? this.state.errors.rank : ""} </label> </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js index b60370894c80de96b3f2fd89043c39fe29373537..d74e5b501de3c45e676b697c2eb5e45231c04be2 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -37,7 +37,7 @@ export class ProjectEdit extends Component { dialog: { header: '', detail: ''}, project: { trigger_priority: 1000, - priority_rank: 0, + rank: 0, quota: [] // Mandatory Field in the back end }, projectQuota: {}, // Holds the value of resources selected with resource_type_id as key @@ -57,7 +57,7 @@ export class ProjectEdit extends Component { this.formRules = { name: {required: true, message: "Name can not be empty"}, description: {required: true, message: "Description can not be empty"}, - priority_rank: {required: true, message: "Enter Project Rank. Min-0.00, Max-6.00"} + rank: {required: true, message: "Enter Project Rank. Min-0.00, Max-6.00"} }; this.defaultResources = [{name:'LOFAR Observing Time'}, {name:'LOFAR Observing Time prio A'}, @@ -245,7 +245,7 @@ export class ProjectEdit extends Component { break; } case 'DECIMAL': { - const previousValue = this.state.project.priority_rank; + const previousValue = this.state.project.rank; value = value.replace(/([^0-9.]+)/, ""); //value = value.replace(/^(0|\.)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,2})?)/g.exec(value); @@ -336,9 +336,9 @@ export class ProjectEdit extends Component { const rule = this.formRules[fieldName]; const fieldValue = this.state.project[fieldName]; if (rule.required) { - if (!fieldValue && fieldName !== 'priority_rank') { + if (!fieldValue && fieldName !== 'rank') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; - } else if (fieldName === 'priority_rank' && fieldValue === '') { + } else if (fieldName === 'rank' && fieldValue === '') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; } else { validFields[fieldName] = true; @@ -352,9 +352,9 @@ export class ProjectEdit extends Component { const rule = this.formRules[fieldName]; const fieldValue = this.state.project[fieldName]; if (rule.required) { - if (!fieldValue && fieldName !== 'priority_rank') { + if (!fieldValue && fieldName !== 'rank') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; - } else if (fieldName === 'priority_rank' && fieldValue === '') { + } else if (fieldName === 'rank' && fieldValue === '') { errors[fieldName] = rule.message?rule.message:`${fieldName} is required`; } else { validFields[fieldName] = true; @@ -376,7 +376,7 @@ export class ProjectEdit extends Component { saveProject() { if (this.validateForm) { const project = { ...this.state.project }; - project['priority_rank'] = project.priority_rank.toFixed(2); + project['rank'] = project.rank.toFixed(2); let archive_location = project.archive_location; let archiveId = project.archiveId; ProjectService.updateProject(this.props.match.params.id, project) @@ -594,11 +594,11 @@ export class ProjectEdit extends Component { data-tip="Priority of this project w.r.t. other projects. Projects can interrupt observations of lower-priority projects. Min-0.00, Max-6.00" inputId="proj-rank" name="rank" data-testid="rank" className="p-inputtext p-component" - value={this.state.project.priority_rank} + value={this.state.project.rank} step="0.01" - onChange={(e)=> this.setProjectParams('priority_rank', e.target.value, "DECIMAL")}/> + onChange={(e)=> this.setProjectParams('rank', e.target.value, "DECIMAL")}/> <label className="error"> - {this.state.errors.priority_rank ? this.state.errors.priority_rank : ""} + {this.state.errors.rank ? this.state.errors.rank : ""} </label> </div> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js index 6cbec17b1e1fcf250a067660062997e554f8e018..b620d1e6bdf388be479ba85254190cebfe664582 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.js @@ -87,7 +87,7 @@ export class ProjectList extends Component { name: "Ingest Automatically", filter: "switch", }, - priority_rank: { + rank: { name: "Project Priority", filter: "range" }, @@ -501,7 +501,7 @@ export class ProjectList extends Component { filler: true, name: "Lofar-TMSS-Commissioning", observing_time: "155852.10", - priority_rank: 10, + rank: 10, private_data: true, project_quota: ["http://localhost:3000/api/project_quota/6/", "http://localhost:3000/api/project_quota/7/"], project_quota_ids: [6, 7], diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/view.js index b6dd3ab0720ddc4b09a5eeae92f877a5b89f4405..5bbc6243b61611fa15e7c5d8fdf4315461e28f75 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/view.js @@ -314,7 +314,7 @@ export class ProjectView extends Component { <label className="col-lg-2 col-md-2 col-sm-12">Cycles</label> <Chips className="col-lg-4 col-md-4 col-sm-12 chips-readonly" disabled value={this.state.project.cycles_ids}></Chips> <label className="col-lg-2 col-md-2 col-sm-12">Project Rank</label> - <span className="col-lg-4 col-md-4 col-sm-12">{this.state.project.priority_rank}</span> + <span className="col-lg-4 col-md-4 col-sm-12">{this.state.project.rank}</span> </div> <div className="p-grid"> <label className="col-lg-2 col-md-2 col-sm-12">Project Status</label> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js index b7ed51a1a2a3303dd6c402d83198aa436ce3d691..29df0325ab9d1b1e5d9bc63cc6c3af4784e06c76 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -30,7 +30,7 @@ class SchedulingUnitList extends Component{ //Expand details for API Query SU_DRAFT_EXPAND = 'scheduling_set,scheduling_set.project,observation_strategy_template,task_drafts,task_drafts.specifications_template'; SU_DRAFT_FIELDS = ['id', 'scheduling_unit_blueprints', 'scheduling_unit_blueprints_ids', 'scheduling_set.name', - 'scheduling_set.project.name', 'name', 'description', 'priority', 'priority_queue_value', 'priority_rank', + 'scheduling_set.project.name', 'name', 'description', 'priority', 'priority_queue_value', 'rank', 'observation_strategy_template.id', 'observation_strategy_template.name', 'observation_strategy_template.description', 'duration', 'do_cancel', 'output_pinned', 'created_at', 'updated_at', 'task_drafts.id', 'task_drafts.name', 'task_drafts.specifications_doc', 'task_drafts.specifications_template.id', 'task_drafts.specifications_template.name', @@ -38,7 +38,7 @@ class SchedulingUnitList extends Component{ ]; SU_BLUEPRINT_EXPAND = 'draft,draft.scheduling_set,draft.scheduling_set.project,draft.observation_strategy_template,task_blueprints,task_blueprints.specifications_template,task_blueprints.subtasks'; SU_BLUEPRINT_FIELDS = ['id', 'status', 'draft_id', 'draft.id', 'draft.scheduling_set.name', 'draft.scheduling_set.project.name', - 'name', 'description', 'priority', 'priority_queue_value', 'priority_rank', 'draft.observation_strategy_template.id', + 'name', 'description', 'priority', 'priority_queue_value', 'rank', 'draft.observation_strategy_template.id', 'draft.observation_strategy_template.name', 'draft.observation_strategy_template.description', 'on_sky_start_time', 'on_sky_stop_time', 'process_start_time', 'process_stop_time', 'duration', 'do_cancel', 'output_pinned', 'created_at', 'updated_at', 'task_blueprints.id', 'task_blueprints.name', 'task_blueprints.specifications_doc', 'task_blueprints.specifications_template.id', @@ -131,7 +131,7 @@ class SchedulingUnitList extends Component{ "Description", "Priority", "Priority Queue", - "Priority Rank", + "Rank", "Scheduling Set", "Template ID", "Template Name", @@ -174,7 +174,7 @@ class SchedulingUnitList extends Component{ actionpath:"actionpath", draft:{name: "Linked Blueprint Id", tooltip: this.COMMA_SEPARATE_TOOLTIP}, //priority_queue: {name: "Priority Queue", filter: "select"}, - priority_rank: {name: "Priority Rank",filter: "rankMinMax"}, + rank: {name: "Rank",filter: "rankMinMax"}, observation_strategy_template_id:{name: "Template ID", tooltip: 'Enter Id and press ‘Enter’ key to search'}, created_at:{ name:"Created_At", @@ -194,7 +194,7 @@ class SchedulingUnitList extends Component{ "Template Description": "filter-input-200", "Scheduling Set": "filter-input-150", "Project":"filter-input-100", - "Priority Rank":"filter-input-75", + "Rank":"filter-input-75", "Duration (HH:mm:ss)":"filter-input-100", "Linked Draft ID":"filter-input-100", "Linked Blueprint ID":"filter-input-100", @@ -567,7 +567,7 @@ class SchedulingUnitList extends Component{ const columnDefinitionToBeRemove = ['status', 'workflowStatus', 'dataAccepted', 'on_sky_start_time', 'on_sky_stop_time', 'process_start_time', 'process_stop_time']; //For Constraint const constColDefToBeRemove = ['observation_strategy_template_name', 'duration', 'observation_strategy_template_id', 'observation_strategy_template_description', 'on_sky_start_time', 'on_sky_stop_time', 'process_start_time', 'process_stop_time', 'task_content', - 'target_observation_sap', 'do_cancel', 'created_at', 'updated_at', 'priority_rank', 'priority_queue', 'output_pinned', 'draft', 'targetName','targetAngle1','targetAngle2','targetRef']; + 'target_observation_sap', 'do_cancel', 'created_at', 'updated_at', 'rank', 'priority_queue', 'output_pinned', 'draft', 'targetName','targetAngle1','targetAngle2','targetRef']; const suFilters = await ScheduleService.getSchedulingUnitFilterDefinition(type); this.columnMap = []; let tmpDefaulColumns = _.cloneDeep(this.state.defaultcolumns[0]); @@ -1423,13 +1423,13 @@ class SchedulingUnitList extends Component{ for ( const value of values) { this.filterQry += 'scheduling_unit_blueprints='+value+"&"; } - } else if (filter.id === 'Priority Rank' && filter.value != '') { + } else if (filter.id === 'Rank' && filter.value != '') { const values = _.split(filter.value, ","); if (values[0] && values[0] !== '' && values[0]>0) { - this.filterQry += "priority_rank_min" +'='+parseFloat(values[0])+'&'; + this.filterQry += "rank_min" +'='+parseFloat(values[0])+'&'; } if (values[1] && values[1] !== '' && values[1]>0) { - this.filterQry += "priority_rank_max" +'='+parseFloat(values[1])+'&'; + this.filterQry += "rank_max" +'='+parseFloat(values[1])+'&'; } } else if ((filter.id === 'Created_At' || filter.id === 'Updated_At') && filter.value != '') { let columnDetails = _.find(this.state.columnMap, {displayName:filter.id}); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js index de82d28f9cad8a527b92ca15096424e10cd02853..04e27998e0b397bb56db02089c7013709ace6aec 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js @@ -44,7 +44,7 @@ class ViewSchedulingUnit extends Component { SU_BLUEPRINT_EXPAND= 'draft.scheduling_constraints_template,draft,draft.scheduling_set,task_blueprints.specifications_template,task_blueprints,task_blueprints.subtasks,draft.observation_strategy_template' SU_BLUEPRINT_FIELDS= ['id','url','created_at','status','tags','output_pinned','duration','name','on_sky_start_time','on_sky_stop_time','scheduling_constraints_doc','description', 'updated_at','draft.url','draft.id','draft.name','draft.scheduling_set.url','draft.scheduling_set.name','draft.scheduling_set.project_id','task_blueprints.status', - 'draft.priority_rank','draft.priority_queue_value','task_blueprints.subtasks.id','task_blueprints.subtasks.primary','task_blueprints.subtasks.specifications_template_id', + 'draft.rank','draft.priority_queue_value','task_blueprints.subtasks.id','task_blueprints.subtasks.primary','task_blueprints.subtasks.specifications_template_id', 'task_blueprints.task_type','task_blueprints.id','task_blueprints.subtasks_ids','task_blueprints.name','task_blueprints.description', 'task_blueprints.short_description','task_blueprints.on_sky_start_time','task_blueprints.on_sky_stop_time','task_blueprints.process_start_time', 'task_blueprints.process_stop_time','task_blueprints.duration','task_blueprints.relative_start_time','task_blueprints.relative_stop_time','task_blueprints.tags', 'task_blueprints.url', @@ -53,7 +53,7 @@ class ViewSchedulingUnit extends Component { 'draft.observation_strategy_template_id','draft.observation_strategy_template.id','draft.observation_strategy_template.name', 'draft.observation_strategy_template.description', 'draft.observation_strategy_template.template'] SU_DRAFT_EXPAND= 'scheduling_constraints_template,scheduling_set,task_drafts.specifications_template,task_drafts,observation_strategy_template,scheduling_unit_blueprints' - SU_DRAFT_FIELDS=['id','url','created_at','status','tags','output_pinned','duration','name','on_sky_start_time','on_sky_stop_time','priority_rank','priority_queue_value','description', + SU_DRAFT_FIELDS=['id','url','created_at','status','tags','output_pinned','duration','name','on_sky_start_time','on_sky_stop_time','rank','priority_queue_value','description', 'scheduling_constraints_doc','scheduling_constraints_template.schema','scheduling_constraints_template.url','observation_strategy_template_id','task_drafts.url','scheduling_constraints_template_id', 'updated_at','scheduling_set.url','scheduling_set.name','scheduling_set.project_id','task_drafts.status','task_drafts.task_type','task_drafts.id','task_drafts.subtasks_ids', 'task_drafts.name','task_drafts.description','task_drafts.short_description','task_drafts.on_sky_start_time','task_drafts.on_sky_stop_time','task_drafts.process_start_time', @@ -1886,8 +1886,8 @@ class ViewSchedulingUnit extends Component { <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.scheduling_set && this.state.scheduleunit.scheduling_set.name}</span> </div> <div className="p-grid"> - <label className="col-lg-2 col-md-2 col-sm-12" >Priority Rank</label> - <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.draft?this.state.scheduleunit.draft.priority_rank: this.state.scheduleunit.priority_rank}</span> + <label className="col-lg-2 col-md-2 col-sm-12" >Rank</label> + <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.draft?this.state.scheduleunit.draft.rank: this.state.scheduleunit.rank}</span> <label className="col-lg-2 col-md-2 col-sm-12">Priority Queue</label> <span className="col-lg-4 col-md-4 col-sm-12">{this.state.scheduleunit.draft? this.state.scheduleunit.draft.priority_queue_value : this.state.scheduleunit.priority_queue_value}</span> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js index 35bea870f27296bd2ecdfcbd0765b34249ba456e..d04a0fba08f2f0dd2c5cfa2456221af43a33ccb6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -56,7 +56,7 @@ export class SchedulingUnitCreate extends Component { name: '', description: '', project: (props.match?props.match.params.project:null) || null, - priority_rank: '', + rank: '', }, projectDisabled: (props.match?(props.match.params.project? true:false):false), // Disable project selection if observStrategy: {}, // Selected strategy to create SU @@ -292,8 +292,8 @@ export class SchedulingUnitCreate extends Component { } }); let schedulingUnit = _.cloneDeep(this.state.schedulingUnit); - if (key === 'priority_rank') { - const previousValue = schedulingUnit.priority_rank; + if (key === 'rank') { + const previousValue = schedulingUnit.rank; value = value.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(value); const val = match[1] + match[2]; @@ -461,7 +461,7 @@ export class SchedulingUnitCreate extends Component { } const const_strategy = {scheduling_constraints_doc: constStrategy, id: this.constraintTemplates[0].id, constraint: this.constraintTemplates[0]}; let schedulingUnit = this.state.schedulingUnit; - schedulingUnit.priority_rank = schedulingUnit.priority_rank === undefined || schedulingUnit.priority_rank === '' ? 0: schedulingUnit.priority_rank.toFixed(4); + schedulingUnit.rank = schedulingUnit.rank === undefined || schedulingUnit.rank === '' ? 0: schedulingUnit.rank.toFixed(4); schedulingUnit = await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, schedulingUnit, const_strategy, station_groups); if (!schedulingUnit.error) { // this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and tasks created successfully!'}); @@ -522,7 +522,7 @@ export class SchedulingUnitCreate extends Component { description: '', project: this.props.match.params.project || null, scheduling_constraints_template_id: this.constraintTemplates[0].id, - priority_rank: '', + rank: '', }, projectDisabled: (this.props.match.params.project? true:false), observStrategy: {}, @@ -699,17 +699,17 @@ export class SchedulingUnitCreate extends Component { </div> </div> <div className="p-field p-grid"> - <label htmlFor="priorityRank" className="col-lg-2 col-md-2 col-sm-12">Priority Rank</label> - <div className="col-lg-3 col-md-3 col-sm-12" data-testid="priority_rank" > + <label htmlFor="rank" className="col-lg-2 col-md-2 col-sm-12">Rank</label> + <div className="col-lg-3 col-md-3 col-sm-12" data-testid="rank" > <input type="number" data-for="reacttooltip" data-iscapture="true" data-tip="Priority of this scheduling unit w.r.t. other scheduling units within the same queue and project.. Min-0.0000, Max-1.0000" inputId="proj-rank" name="rank" data-testid="rank" className="p-inputtext p-component p-filled" - value={this.state.schedulingUnit.priority_rank} + value={this.state.schedulingUnit.rank} step="0.0001" - onChange={(e)=> this.setSchedUnitParams('priority_rank', e.target.value)}/> + onChange={(e)=> this.setSchedUnitParams('rank', e.target.value)}/> </div> <div className="col-lg-1 col-md-1 col-sm-12"></div> <label htmlFor="priority_queue" className="col-lg-2 col-md-2 col-sm-12">Priority Queue</label> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index 83ea33f59a24bd1b2cf67ad05842f435ad6c2911..29012f1625ddefbccae134ace6fa73d6cb7939d0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -298,8 +298,8 @@ export class EditSchedulingUnit extends Component { */ setSchedUnitParams(key, value) { let schedulingUnit = _.cloneDeep(this.state.schedulingUnit); - if (key === 'priority_rank') { - const previousValue = schedulingUnit.priority_rank; + if (key === 'rank') { + const previousValue = schedulingUnit.rank; value = value.replace(/([^0-9.]+)/, ""); const match = /(\d{0,1})[^.]*((?:\.\d{0,4})?)/g.exec(value); const val = match[1] + match[2]; @@ -456,7 +456,7 @@ export class EditSchedulingUnit extends Component { }); }); let schedulingUnit = this.state.schedulingUnit; - schUnit.priority_rank = schUnit.priority_rank === ''?0:schUnit.priority_rank.toFixed(4); + schUnit.rank = schUnit.rank === ''?0:schUnit.rank.toFixed(4); schedulingUnit = await ScheduleService.updateSUDraftFromObservStrategy(observStrategy,schUnit,this.state.taskDrafts, this.state.tasksToUpdate, station_groups); if (!schedulingUnit.error) { this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and Tasks updated successfully!'}); @@ -615,19 +615,19 @@ export class EditSchedulingUnit extends Component { </div> </div> <div className="p-field p-grid"> - <label htmlFor="priorityRank" className="col-lg-2 col-md-2 col-sm-12">Priority Rank</label> - <div className="col-lg-3 col-md-3 col-sm-12" data-testid="priority_rank" > + <label htmlFor="rank" className="col-lg-2 col-md-2 col-sm-12">Rank</label> + <div className="col-lg-3 col-md-3 col-sm-12" data-testid="rank" > <input type="number" data-for="reacttooltip" data-iscapture="true" data-tip="Priority of this scheduling unit w.r.t. other scheduling units within the same queue and project.. Min-0.0000, Max-1.0000" inputId="proj-rank" name="rank" data-testid="rank" className="p-inputtext p-component p-filled" - value={this.state.schedulingUnit.priority_rank} + value={this.state.schedulingUnit.rank} step="0.0001" - onChange={(e)=> this.setSchedUnitParams('priority_rank', e.target.value)}/> + onChange={(e)=> this.setSchedUnitParams('rank', e.target.value)}/> <label className="error"> - {this.state.errors.priority_rank ? this.state.errors.priority_rank : ""} + {this.state.errors.rank ? this.state.errors.rank : ""} </label> </div> <div className="col-lg-1 col-md-1 col-sm-12"></div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index b8d7bdc21b6eb0ad55683bb6a9a26cbd6b61ba43..0b10676c9f62b4989c6b384b329b7ba047ca806f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -734,7 +734,7 @@ export class SchedulingSetCreate extends Component { id: scheduleunit.id, suname: scheduleunit.name, sudesc: scheduleunit.description, - priority_rank: scheduleunit.priority_rank, + rank: scheduleunit.rank, priority_queue: scheduleunit.priority_queue_value, //set default TRUE and it will reset this value while validating the row and will skip the invalid rows when save the row data isValid: true, @@ -1134,8 +1134,8 @@ export class SchedulingSetCreate extends Component { } else { return { backgroundColor: ''};} },}, - {headerName: 'Priority Rank', field: 'priority_rank',cellEditor: 'numericEditor', cellStyle: function(params) { - let value = params.data.priority_rank? params.data.priority_rank: params.data.gdef_priority_rank ? params.data.gdef_priority_rank : ''; + {headerName: 'Rank', field: 'rank',cellEditor: 'numericEditor', cellStyle: function(params) { + let value = params.data.rank? params.data.rank: params.data.gdef_rank ? params.data.gdef_rank : ''; if (value && value !== '') { const splitValue = _.split((value+''),"."); if (value < 0 || value > 1 || (splitValue.length > 1 && splitValue[1].length > 4)) { @@ -1149,11 +1149,11 @@ export class SchedulingSetCreate extends Component { cellEditorParams: {values: this.state.priorityQueuelist}},] } ]; - colProperty = {'ID':'id', 'Name':'suname', 'Description':'sudesc', 'Priority Rank':'priority_rank', 'Priority Queue':'priority_queue'}; + colProperty = {'ID':'id', 'Name':'suname', 'Description':'sudesc', 'Rank':'rank', 'Priority Queue':'priority_queue'}; columnMap['Scheduling Unit'] = colProperty; this.colKeyOrder.push("suname"); this.colKeyOrder.push("sudesc"); - this.colKeyOrder.push("priority_rank"); + this.colKeyOrder.push("rank"); this.colKeyOrder.push("priority_queue"); // Create Constraint Column for AG Grid columnDefs = await this.getConstraintColumns(columnDefs); @@ -1631,7 +1631,7 @@ export class SchedulingSetCreate extends Component { isValidRow = false; errorMsg += column.colDef.headerName+", "; } else { - if (column.colId === 'priority_rank'){ + if (column.colId === 'rank'){ let value = rowData[column.colId]?rowData[column.colId]:'0'; rowData[column.colId] = value; const splitValue = _.split((value+'') , "."); @@ -2020,7 +2020,7 @@ export class SchedulingSetCreate extends Component { newSU['name'] = suRow.suname; newSU['description'] = suRow.sudesc; newSU['output_pinned'] = this.state.selectedProject[0].auto_pin; - newSU['priority_rank'] = suRow.priority_rank && suRow.priority_rank.length>0? _.round(parseFloat(suRow.priority_rank), 4):suRow.priority_rank; + newSU['rank'] = suRow.rank && suRow.rank.length>0? _.round(parseFloat(suRow.rank), 4):suRow.rank; if (suRow.priority_queue ) { newSU['priority_queue'] = suRow.priority_queue; } @@ -2046,7 +2046,7 @@ export class SchedulingSetCreate extends Component { let newSchedulueUnit = { description: suRow.sudesc, name: suRow.suname, - priority_rank: suRow.priority_rank && suRow.priority_rank.length > 0 ? _.round(parseFloat(suRow.priority_rank), 4) : suRow.priority_rank, + rank: suRow.rank && suRow.rank.length > 0 ? _.round(parseFloat(suRow.rank), 4) : suRow.rank, priority_queue: suRow.priority_queue, scheduling_constraints_template_id: newSU['scheduling_constraints_template_id'], scheduling_set_id: newSU['scheduling_set_id'], diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js index b6684a162480a97b754ef2aa9cc10c6fe18abcd8..43a39a182eecf16047bb42aa1a42332e52b90f36 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -24,7 +24,7 @@ const SU_FETCH_FIELDS = [ "id", "on_sky_start_time", "on_sky_stop_time", "scheduled_start_time", "scheduled_stop_time", "duration", - "priority_rank", + "rank", "updated_at", "draft.id", "draft.name", @@ -718,8 +718,8 @@ const ScheduleService = { // Create the scheduling unit draft with observation strategy and scheduling set const url = `/api/scheduling_unit_observing_strategy_template/${observStrategy.id}/create_scheduling_unit/?scheduling_set_id=${schedulingUnit.scheduling_set_id}&name=${schedulingUnit.name}&description=${schedulingUnit.description}` const suObsResponse = await axios.post(url); - if (schedulingUnit.priority_rank !== '') { - suObsResponse.data.priority_rank = schedulingUnit.priority_rank; + if (schedulingUnit.rank !== '') { + suObsResponse.data.rank = schedulingUnit.rank; } if (schedulingUnit.priority_queue !== '') { suObsResponse.data.priority_queue = schedulingUnit.priority_queue; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/shared/timeline.constants.js b/SAS/TMSS/frontend/tmss_webapp/src/shared/timeline.constants.js index eb1e639f5dde8fef297330ff3cbd41667e0a7d2c..d56c3e3453ebb5bb1a8bbf9f953124246ef17532 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/shared/timeline.constants.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/shared/timeline.constants.js @@ -35,7 +35,7 @@ const TimelineConstants = { dataAccepted: { name: "Data Accepted" }, - priority_rank: { + rank: { name: "Priority" }, project: { @@ -80,7 +80,7 @@ const TimelineConstants = { workflowStatus: { name: "Workflow Status" }, - priority_rank: { + rank: { name: "Priority" }, project: {