Skip to content
Snippets Groups Projects

Lofar release 4 0

Merged Jorrit Schaap requested to merge LOFAR-Release-4_0 into master
1 file
+ 12
0
Compare changes
  • Side-by-side
  • Inline
  • 65c562b5
    SW-826: the taskprescheduler should NOT insert the task into the RADB. Added... · 65c562b5
    Jorrit Schaap authored
    SW-826: the taskprescheduler should NOT insert the task into the RADB. Added that requirement to the test, which now fails. Next commit has the fix for this bug.
@@ -201,6 +201,7 @@ class PreschedulerTest(unittest.TestCase):
def test_onObservationApproved_GetSpecification(self):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskGetSpecification.assert_any_call(otdb_id = self.otdb_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
# def test_resourceIndicatorsFromParset(self):
# specification = resourceIndicatorsFromParset(self.observation_specification_tree)
@@ -221,6 +222,7 @@ class PreschedulerTest(unittest.TestCase):
def test_onObservationApproved_log_mom_id_found(self, logger_mock):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.info.assert_any_call('Found mom_id %s for otdb_id %s', self.mom_id, self.otdb_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
@mock.patch('lofar.sas.resourceassignment.common.specification.logger')
def test_onObservationApproved_log_mom_id_not_found(self, logger_mock):
@@ -230,6 +232,7 @@ class PreschedulerTest(unittest.TestCase):
'specification': observation_specification_tree_no_momid}
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.info.assert_any_call('Did not find a mom_id for task otdb_id=%s', self.otdb_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
@mock.patch('lofar.sas.resourceassignment.common.specification.logger')
def test_onObservationApproved_otdb_specification_problem(self, logger_mock):
@@ -237,32 +240,38 @@ class PreschedulerTest(unittest.TestCase):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.exception.assert_called()
logger_mock.error.assert_called()
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
# TODO not sure how to fix self.radb_mock.updateTaskStatusForOtdbId.assert_any_call(self.otdb_id, 'error')
@mock.patch('lofar.sas.resourceassignment.common.specification.logger')
def test_onObservationApproved_log_trigger_found_0(self, logger_mock):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.info.assert_any_call('Found a task mom_id=%s with a trigger_id=%s', self.mom_id, self.trigger_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
@mock.patch('lofar.sas.resourceassignment.taskprescheduler.taskprescheduler.logger')
def test_onObservationApproved_log_no_trigger(self, logger_mock):
self.momrpc_mock.get_trigger_time_restrictions.return_value = {"trigger_id": None}
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.info.assert_any_call('Did not find a trigger for task mom_id=%s', self.mom_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_onObservationApproved_no_trigger(self):
self.momrpc_mock.get_trigger_time_restrictions.return_value = {"trigger_id": None}
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskSetStatus.assert_not_called()
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
@mock.patch('lofar.sas.resourceassignment.taskprescheduler.taskprescheduler.logger')
def test_onObservationApproved_log_trigger_found_1(self, logger_mock):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
logger_mock.info.assert_any_call('Setting status (%s) for otdb_id %s', 'prescheduled', self.otdb_id)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_onObservationApproved_SetSpecification(self):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskSetSpecification.assert_any_call(self.otdb_id, self.otdb_info)
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_onObservationApproved_pipeline_SetSpecification(self):
self.otdbrpc_mock.taskGetSpecification.return_value = {'otdb_id': self.otdb_id,
@@ -272,10 +281,12 @@ class PreschedulerTest(unittest.TestCase):
self.radb_mock.getTask.return_value = task
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskSetSpecification.assert_called()
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_onObservationApproved_taskSetStatus(self):
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskSetStatus.assert_any_call(self.otdb_id, 'prescheduled')
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_setOTDBinfo_taskSetStatus(self):
self.taskprescheduler.setOTDBinfo(self.otdb_id, self.otdb_info, 'prescheduled')
@@ -294,6 +305,7 @@ class PreschedulerTest(unittest.TestCase):
self.radb_mock.getTask.return_value = task
self.taskprescheduler.onObservationApproved(self.otdb_id, self.modification_time)
self.otdbrpc_mock.taskSetStatus.assert_any_call(self.otdb_id, 'prescheduled')
self.radb_mock.insertOrUpdateSpecificationAndTask.assert_not_called()
def test_calculateCobaltSettings(self):
spec = Specification(self.otdbrpc_mock, self.momrpc_mock, self.radb_mock)
Loading