diff --git a/SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py b/SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py index f87f681936b29da8a8af3efbd7b706867c793653..a03bf5332c8271655feff8b4f69a13245cb8af3e 100755 --- a/SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py +++ b/SAS/ResourceAssignment/ResourceAssigner/lib/resource_assigner.py @@ -156,7 +156,7 @@ class ResourceAssigner(object): # specification, task and predecessor/successor relations, so approved tasks appear correctly in the web # scheduler. if spec.status == 'approved': # Only needed to send misc field info (storagemanager) to OTDB - logger.info('Task otdb_id=%s is only approved, no resource assignment needed yet' % otdb_id) + logger.info('Task otdb_id=%s tmss_id=%s is only approved, no resource assignment needed yet', otdb_id, tmss_id) self._send_task_status_notification(spec, 'approved') return #TODO have Specification propagate to the estimator? @@ -201,6 +201,7 @@ class ResourceAssigner(object): content = { 'radb_id': spec.radb_id, 'otdb_id': spec.otdb_id, + 'tmss_id': spec.tmss_id, 'mom_id': spec.mom_id } subject = 'Task' + new_status[0].upper() + new_status[1:] #TODO this is MAGIC, needs explanation! diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py index caeeb439d076c50b35ef474ed3270b5a716266ec..29358de27d660b822a48c48a705f5dd0ec6ff135 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py @@ -1619,7 +1619,9 @@ class RADatabase(PostgresDatabaseConnection): Removes resource_claims for existing task with same otdb_id if present in the same transaction. ''' try: - existing_task = self.getTask(otdb_id=otdb_id) + existing_task=None + if otdb_id is not None: + existing_task = self.getTask(otdb_id=otdb_id) if existing_task is None and tmss_id is not None: existing_task = self.getTask(tmss_id=tmss_id) if existing_task is None and mom_id is not None: diff --git a/SAS/TMSS/src/tmss/tmssapp/subtasks.py b/SAS/TMSS/src/tmss/tmssapp/subtasks.py index 9a23feefef313dcdbd6f53294974b068bad8a49b..4a1ecadc7c3acbcc1920d46d36ff246d6d9b0bc1 100644 --- a/SAS/TMSS/src/tmss/tmssapp/subtasks.py +++ b/SAS/TMSS/src/tmss/tmssapp/subtasks.py @@ -462,12 +462,12 @@ def schedule_observation_subtask(observation_subtask: Subtask): # step 3: resource assigner from lofar.sas.resourceassignment.resourceassigner.rarpc import RARPC with RARPC.create() as rarpc: - rarpc.do_assignment(observation_subtask.id, { 'otdb_id': observation_subtask.id, - 'task_type': 'observation', - 'task_subtype': 'bfmeasurement', - 'status': 'approved', - 'starttime': observation_subtask.start_time, - 'endtime': observation_subtask.stop_time}) + rarpc.do_assignment({ 'tmss_id': observation_subtask.id, + 'task_type': 'observation', + 'task_subtype': 'bfmeasurement', + 'status': 'approved', + 'starttime': observation_subtask.start_time, + 'endtime': observation_subtask.stop_time}) # step 4: create output dataproducts, and link these to the output specifications_doc = observation_subtask.specifications_doc