diff --git a/.gitattributes b/.gitattributes index 86775d6bad5debf3a2ef0d4014f5b014aa4c734d..bb24505075b3b7f9d039771f642db0652291227d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5682,6 +5682,7 @@ SAS/ResourceAssignment/ResourceAssignmentEstimator/test/__init__.py -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_beam_observation -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_calibration_pipeline -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_calibration_pipeline_predecessor_558022 -text +SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_imaging_pipeline -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_interferometer_observation -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_long_baseline_pipeline -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_long_baseline_pipeline_predecessor_556601 -text @@ -5693,6 +5694,7 @@ SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_est SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_pulsar_pipeline -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_beam_observation -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_calibration_pipeline -text +SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_imaging_pipeline -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_interferometer_observation -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_long_baseline_observation -text SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_long_baseline_pipeline -text diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_imaging_pipeline b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_imaging_pipeline new file mode 100644 index 0000000000000000000000000000000000000000..9001f539b1bd22d8a2c9a3350847be901f194558 --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.in_imaging_pipeline @@ -0,0 +1,54 @@ +{ + 'Observation.DataProducts.Output_InstrumentModel.enabled': False, + 'Observation.DataProducts.Output_CoherentStokes.storageClusterName': '', + 'Observation.stopTime': '2016-12-09 16:01:25', + 'Observation.VirtualInstrument.stationList': [ + ], + 'Observation.DataProducts.Input_CoherentStokes.enabled': False, + 'Observation.DataProducts.Output_CoherentStokes.enabled': False, + 'Observation.DataProducts.Output_Correlated.storageClusterName': '', + 'Observation.DataProducts.Input_Correlated.identifications': [ + 'mom.G732487.B0.1.C.SAP000.uv.dps' + ], + 'Observation.DataProducts.Output_SkyImage.storageClusterName': 'CEP4', + 'Observation.DataProducts.Output_InstrumentModel.identifications': [ + ], + 'Observation.antennaSet': 'LBA_INNER', + 'Observation.DataProducts.Output_Pulsar.identifications': [ + ], + 'Observation.nrBitsPerSample': '16', + 'Observation.DataProducts.Output_IncoherentStokes.enabled': False, + 'Observation.DataProducts.Input_IncoherentStokes.enabled': False, + 'Observation.DataProducts.Input_Correlated.enabled': True, + 'Observation.DataProducts.Output_Pulsar.enabled': False, + 'Observation.DataProducts.Output_Correlated.identifications': [ + ], + 'Observation.DataProducts.Input_CoherentStokes.identifications': [ + ], + 'Observation.DataProducts.Output_InstrumentModel.storageClusterName': '', + 'Observation.DataProducts.Input_InstrumentModel.enabled': False, + 'Observation.DataProducts.Output_SkyImage.enabled': True, + 'Version.number': '33385', + 'Observation.DataProducts.Output_Pulsar.storageClusterName': '', + 'Observation.momID': '737233', + 'Observation.DataProducts.Input_InstrumentModel.identifications': [ + ], + 'Observation.DataProducts.Output_SkyImage.identifications': [ + 'mom.G732488.B0.PI0.dps' + ], + 'Observation.ObservationControl.PythonControl.Imaging.slices_per_image': 3, + 'Observation.ObservationControl.PythonControl.Imaging.subbands_per_image': 4, + 'Observation.startTime': '2016-12-09 07:21:25', + 'Observation.nrBeams': '0', + 'Observation.Scheduler.taskDuration': '31200', + 'Observation.DataProducts.Output_IncoherentStokes.identifications': [ + ], + 'Observation.DataProducts.Input_IncoherentStokes.identifications': [ + ], + 'Observation.DataProducts.Output_CoherentStokes.identifications': [ + ], + 'Observation.DataProducts.Output_Correlated.enabled': False, + 'Observation.DataProducts.Output_IncoherentStokes.storageClusterName': '', + 'Observation.sampleClock': '200' +} + diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_imaging_pipeline b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_imaging_pipeline new file mode 100644 index 0000000000000000000000000000000000000000..6b51700eb530c195a572b8b2524305bdb64db0ca --- /dev/null +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/data_sets/t_resource_estimator.out_imaging_pipeline @@ -0,0 +1 @@ +"{'1': {'pipeline': {'errors': [], 'estimates': [{'root_resource_group': 'CEP4', 'output_files': {'img': [{'identification': 'mom.G732488.B0.PI0.dps', 'properties': {'img_file_size': 1000, 'img_otdb_id': 1, 'nr_of_img_files': 10}}]}, 'resource_types': {'bandwidth': 3, 'storage': 10000}, 'resource_count': 1, 'input_files': {'uv': [{'identification': 'mom.G732487.B0.1.C.SAP000.uv.dps', 'sap_nr': 0, 'properties': {'nr_of_uv_files': 120, 'start_sb_nr': 0, 'uv_file_size': 3617984960, 'uv_otdb_id': 2}}]}}]}}}" diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/t_resource_estimator.py b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/t_resource_estimator.py index c0b3fad856bdd6c6cae9ad95485f72d460ea6dee..1a7826e3f337b10246cd38c8ce139b7fed999d8c 100755 --- a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/t_resource_estimator.py +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/t_resource_estimator.py @@ -156,7 +156,7 @@ class TestEstimationsAgainstGoldenOutput(unittest.TestCase): specification_tree = self.get_specification_tree(data_set_filepath, task_type, task_subtype) self.add_predecessor_to_specification_tree(os.path.join(self.data_sets_dir, - 't_resource_estimator.in_calibration_pipeline_predecessor_558022'), + 't_resource_estimator.in_calibration_pipeline_predecessor_558022'), # predecessor also used for imaging pipeline test 'observation', 'bfmeasurement', specification_tree['predecessors']) @@ -174,6 +174,34 @@ class TestEstimationsAgainstGoldenOutput(unittest.TestCase): self.assertEqual(len(error_messages), 0, "\nThe uut reported errors:\n" + '\n- '.join(error_messages)) self.assertEqual(self.get_datastructure_as_string(estimation), golden_estimation) + def test_estimate_for_imaging_pipeline(self): + """ Verify estimation for an imaging pipeline specification tree against the golden output """ + # Arrange + data_set_filepath = os.path.join(self.data_sets_dir, 't_resource_estimator.in_imaging_pipeline') + golden_output_filepath = os.path.join(self.data_sets_dir, 't_resource_estimator.out_imaging_pipeline') + task_type = 'pipeline' + task_subtype = 'imaging pipeline' + specification_tree = self.get_specification_tree(data_set_filepath, task_type, task_subtype) + + self.add_predecessor_to_specification_tree(os.path.join(self.data_sets_dir, + 't_resource_estimator.in_calibration_pipeline_predecessor_558022'), # predecessor also used for calibration pipeline test + 'observation', + 'bfmeasurements', + specification_tree['predecessors']) + + uut = ResourceEstimatorHandler() + golden_estimation = self.get_golden_estimate(golden_output_filepath, + uut._get_estimated_resources, + specification_tree) + + # Act + estimation = uut.handle_message({'specification_tree': specification_tree}) + + # Assert + error_messages = self.get_uut_errors(estimation) + self.assertEqual(len(error_messages), 0, "\nThe uut reported errors:\n" + '\n- '.join(error_messages)) + self.assertEqual(self.get_datastructure_as_string(estimation), golden_estimation) + def test_estimate_for_long_baseline_pipeline(self): """ Verify estimation for a long baseline pipeline specification tree against the golden output """ # Arrange @@ -343,4 +371,4 @@ class TestEstimationsAgainstGoldenOutput(unittest.TestCase): f.close() if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/testset.py b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/testset.py index b75c8ad545c15198b5ae94fdcff951f6161f1ffb..d5b5773f253bb95b2103ce870812f7e3beec1093 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/testset.py +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/test/testset.py @@ -222,8 +222,8 @@ class TestSet(object): checkset = """ # for image-pipeline dp.output.skyimage.enabled= true - dp.output.skyimage.slices_per_image= 1 - dp.output.skyimage.subbands_per_image= 2 + dp.output.skyimage.slices_per_image= 3 + dp.output.skyimage.subbands_per_image= 4 """ self.check_set.import_string(checkset) self.check_set.import_string(checkset)