diff --git a/SAS/ResourceAssignment/ResourceAssigner/lib/raservice.py b/SAS/ResourceAssignment/ResourceAssigner/lib/raservice.py index f8c29ea34329ca4f3d4c23265c2c1013a1007a29..269fb8a19d785a2ff9de23f481e65fa98fd08e6c 100755 --- a/SAS/ResourceAssignment/ResourceAssigner/lib/raservice.py +++ b/SAS/ResourceAssignment/ResourceAssigner/lib/raservice.py @@ -138,6 +138,12 @@ def main(): parser.add_option('--mom_query_servicename', dest='mom_query_servicename', type='string', default=DEFAULT_MOMQUERY_SERVICENAME, help='Name of the momqueryservice, default: %default') + parser.add_option('--observation_control_busname', dest='observation_control_busname', type='string', + default=DEFAULT_OBSERVATION_CONTROL_BUS_NAME, + help='Name of the bus exchange on the qpid broker on which the observation_controlservice listens, default: %default') + parser.add_option('--observation_control_servicename', dest='observation_control_servicename', type='string', + default=DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME, + help='Name of the observation_controlservice, default: %default') parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging') parser.add_option_group(dbcredentials.options_group(parser)) diff --git a/SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py b/SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py index 27abba6f628269ef4e862fd2a152dda5a963d8e9..645eaf37d0b643a10eeb22be30b04058a1ca75f7 100644 --- a/SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py +++ b/SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py @@ -518,7 +518,10 @@ class PriorityScheduler(StationScheduler): #killing and unscheduling happens in the resource assigner for t in (self.tasks_to_kill + self.tasks_to_unschedule): - spec = Specification(None, None, None, None) #Easier than creating a custom object instance + # _send_task_status_notification in resourceassigner expects an object (of type Specification) + # It seems easier to create a Specification than creating a custom object/class just for this + # and adapting the resourceassigner code + spec = Specification(None, None, None, None) spec.radb_id = t["id"] spec.mom_id = t["mom_id"] spec.otdb_id = t["otdb_id"] diff --git a/SAS/ResourceAssignment/ResourceAssigner/test/t_resourceassigner.py b/SAS/ResourceAssignment/ResourceAssigner/test/t_resourceassigner.py index e68ce0961b928174468d863aa500328a6a7b9d3e..5c32738b3c989540603e468d9fac40ff55c7a215 100755 --- a/SAS/ResourceAssignment/ResourceAssigner/test/t_resourceassigner.py +++ b/SAS/ResourceAssignment/ResourceAssigner/test/t_resourceassigner.py @@ -2018,23 +2018,8 @@ class ResourceAssignerTest(unittest.TestCase): self.resource_assigner._kill_task(spec) self.obscontrol_mock.abort_observation.assert_called_with(spec.otdb_id) - # Can't run a test like this, as we're not having a RADB and schedulers that actually do something or any - # tests with triggered observations or even multiple observations. - #def test_unschedule_task(self): - # spec = Specification(None, None, None, None) # Easier than creating a custom object instance - # spec.radb_id = 1 - # spec.mom_id = 2 - # spec.otdb_id = 3 - # spec.status = "approved" - # spec.type = "observation" - # - # content = {'radb_id': self.task_id, 'otdb_id': self.task_otdb_id, 'mom_id': self.task_mom_id} - # subject = 'Task' + 'Scheduled' - # - # self.resource_assigner.do_assignment(self.specification_tree['otdb_id'], self.specification_tree) - # - # self.assertBusNotificationAndLogging(content, subject) - + #This class is currently missing any tests of interaction between tasks already scheduled and new tasks, + # e.g. triggered ones. It would require a totally different way to set up the tests to be able to test this. if __name__ == '__main__': unittest.main()