diff --git a/.gitattributes b/.gitattributes index dd960ca3f005f2226151d31b16d503dd6b43e3c0..a9662eef3d87528730ce6e6fd6a032cc0e864e4d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4557,6 +4557,9 @@ SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_propagator.sh SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_rotspservice.py -text SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_rotspservice.run -text SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_rotspservice.sh -text +SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.py -text +SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.run -text +SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.sh -text SAS/ResourceAssignment/ResourceAssigner/CMakeLists.txt -text SAS/ResourceAssignment/ResourceAssigner/bin/CMakeLists.txt -text SAS/ResourceAssignment/ResourceAssigner/bin/resourceassigner -text diff --git a/SAS/ResourceAssignment/RATaskSpecifiedService/doc/RATaskSpecifiedService.md b/SAS/ResourceAssignment/RATaskSpecifiedService/doc/RATaskSpecifiedService.md index 5b4c7b7d3462b86bd4cb948a181871895ea5f43c..95f4a8a77668c24aff05da451de15e67bac32c15 100644 --- a/SAS/ResourceAssignment/RATaskSpecifiedService/doc/RATaskSpecifiedService.md +++ b/SAS/ResourceAssignment/RATaskSpecifiedService/doc/RATaskSpecifiedService.md @@ -15,9 +15,8 @@ - Auke Klazema <klazema@astron.nl> ### Overview -- See the [resource assigner redesign](https://www.astron.nl/lofarwiki/doku.php?id=rrr:redesign_resource_assignment_system) for some diagrams. -- The service fits in the OTDB Task Watcher in the first diagram, and in the ResourceAssignService of the detailed view. It writes to the lofar.ra.notification bus. -- *todo*: come up with a diagram that matches the actual implementation +- Find diagrams (in graphml/odf format) can be found in the [SVN documentation on SAS redesign for responsive telescope](https://svn.astron.nl/LOFAR/trunk//SAS/doc/SAS_redesign_for_responsive_telescope/) +- Find outdated diagrams in png format in the wiki page [resource assigner redesign](https://www.astron.nl/lofarwiki/doku.php?id=rrr:redesign_resource_assignment_system). This service fits in the OTDB Task Watcher in the first diagram, and in the ResourceAssignService of the detailed view. It writes to the lofar.ra.notification bus. - - - diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/translator.py b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/translator.py index f136fb3e1b2e387b16c6f2d992b74ffba51b18d5..c13700d0bb171838f3f67e0add9a801b6510ae2f 100755 --- a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/translator.py +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/lib/translator.py @@ -507,6 +507,6 @@ class RAtoOTDBTranslator(): if 'storagemanager' in mom_info: storagemanager = mom_info["storagemanager"] logging.info("Adding storagemanager to parset: %s" % storagemanager) - parset["Observation.ObservationControl.PythonControl.DPPP.storagemanager.name"] = storagemanager + parset[PREFIX+"ObservationControl.PythonControl.DPPP.storagemanager.name"] = storagemanager return parset diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/CMakeLists.txt b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/CMakeLists.txt index e6a88314755fa56a743ea53301ca3ed23e87850f..7b920f513eaa1c09368a584a471f582cbf244186 100644 --- a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/CMakeLists.txt +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/CMakeLists.txt @@ -3,4 +3,5 @@ include(LofarCTest) lofar_add_test(t_rotspservice) lofar_add_test(t_propagator) +lofar_add_test(t_translator) diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.py b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.py new file mode 100644 index 0000000000000000000000000000000000000000..a79cc56e49ecfa73d17425b5b840ba8b94f9da54 --- /dev/null +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.py @@ -0,0 +1,39 @@ +import unittest +from mock import MagicMock +from lofar.sas.resourceassignment.ratootdbtaskspecificationpropagator.translator import RAtoOTDBTranslator, PREFIX +import datetime + + +class RAtoOTDBPropagatorTest(unittest.TestCase): + + def setUp(self): + pass + + def test_CreateParset_returns_storagemanager_from_MoM_as_DPPP_parameter(self): + + # test values: + otdb_id = 123 + + start = datetime.datetime.utcnow() + end = datetime.datetime.utcnow() + datetime.timedelta(hours=1) + ra_info = {"starttime" : start, "endtime": end, "status": "test_in_progress", "type": "test", "cluster": "CEP4"} + + project_name = "myproject" + + storagemanager = "d.y.s.c.o." + mom_info = {'status': None, 'max_duration': None, 'min_starttime': None, 'task_type': None, 'task_id': None, + 'max_endtime': None, 'specification': {'Observation.stopTime': None, 'Observation.startTime': None}, + 'trigger_id': None, 'min_duration': None, 'task_subtype': None, 'cluster': None, 'predecessors': [], + 'starttime': None, 'successors': [], 'duration': None, 'mom_id': None, + 'storagemanager': storagemanager, 'endtime': None, 'otdb_id': None} + + # trigger action: + value = RAtoOTDBTranslator().CreateParset(otdb_id, ra_info, project_name, mom_info) + + # assert: + self.assertEqual(value[PREFIX+"ObservationControl.PythonControl.DPPP.storagemanager.name"], storagemanager) + + +if __name__ == "__main__": + unittest.main() + diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.run b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.run new file mode 100755 index 0000000000000000000000000000000000000000..ab644b37e44e70b012d30e79d18cfb9100a4e303 --- /dev/null +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.run @@ -0,0 +1,6 @@ +#!/bin/bash + +# Run the unit test +source python-coverage.sh +python_coverage_test "translator*" t_translator.py + diff --git a/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.sh b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.sh new file mode 100755 index 0000000000000000000000000000000000000000..722a0090c3d0cbf07b76607779b65216bbded3a8 --- /dev/null +++ b/SAS/ResourceAssignment/RAtoOTDBTaskSpecificationPropagator/test/t_translator.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./runctest.sh t_translator + diff --git a/SAS/ResourceAssignment/doc/resource_assignment.md b/SAS/ResourceAssignment/doc/resource_assignment.md index 6e49523d2cbe1bf3edabdd1d96c388de96a4389d..30ff88b6fb91b8c492b008b93a95a57825b84a84 100644 --- a/SAS/ResourceAssignment/doc/resource_assignment.md +++ b/SAS/ResourceAssignment/doc/resource_assignment.md @@ -35,6 +35,7 @@ interact with the system in a manner visible to other users. ### Overview See [Wiki documentation Resource Assigner](https://www.astron.nl/lofarwiki/doku.php?id=rrr:redesign_resource_assignment_system) +Updated diagrams (in graphml/odf format) can be found in the [SVN documentation on SAS redesign for responsive telescope](https://svn.astron.nl/LOFAR/trunk//SAS/doc/SAS_redesign_for_responsive_telescope/) TODO - *Add a diagram*