diff --git a/daliuge-engine/test/graphs/application_args.graph b/daliuge-engine/test/graphs/application_args.graph new file mode 100644 index 000000000..1bd27eb65 --- /dev/null +++ b/daliuge-engine/test/graphs/application_args.graph @@ -0,0 +1,99 @@ +[ + { + "oid": "a", + "type": "app", + "app": "dlg.apps.simple.RandomArrayApp", + "rank": [ + 0 + ], + "loop_cxt": null, + "tw": 5, + "num_cpus": 1, + "appclass": "dlg.apps.simple.RandomArrayApp", + "execution_time": 5, + "group_start": false, + "input_error_threshold": 0, + "n_tries": 1, + "applicationArgs": { + "size": { + "text": "Size", + "value": 50, + "defaultValue": "100", + "description": "The size of the array", + "readonly": false, + "type": "Integer", + "precious": false, + "options": [], + "positional": false + }, + "integer": { + "text": "Integer", + "value": true, + "defaultValue": "True", + "description": "Generate integer array?", + "readonly": false, + "type": "Boolean", + "precious": false, + "options": [], + "positional": false + }, + "low": { + "text": "Low", + "value": 34, + "defaultValue": "0", + "description": "Low value of range in array [inclusive]", + "readonly": false, + "type": "Float", + "precious": false, + "options": [], + "positional": false + }, + "high": { + "text": "High", + "value": 3456, + "defaultValue": "1", + "description": "High value of range of array [exclusive]", + "readonly": false, + "type": "Float", + "precious": false, + "options": [], + "positional": false + } + }, + "iid": "0", + "lg_key": -2, + "dt": "PythonApp", + "nm": "RandomArrayApp", + "outputs": [ + { + "b": "array" + } + ], + "node": "127.0.0.1", + "island": "127.0.0.1" + }, + { + "oid": "b", + "type": "plain", + "storage": "Memory", + "rank": [ + 0 + ], + "loop_cxt": null, + "dw": 5, + "data_volume": 5, + "group_end": false, + "applicationArgs": {}, + "iid": "0", + "lg_key": -3, + "dt": "Memory", + "nm": "Memory", + "producers": [ + { + "a": "array" + } + ], + "node": "127.0.0.1", + "island": "127.0.0.1" + } +] diff --git a/daliuge-engine/test/test_graph_loader.py b/daliuge-engine/test/test_graph_loader.py index 1044f1a16..3daba54f3 100644 --- a/daliuge-engine/test/test_graph_loader.py +++ b/daliuge-engine/test/test_graph_loader.py @@ -27,6 +27,7 @@ from dlg.ddap_protocol import DROPLinkType, DROPRel from dlg.drop import InMemoryDROP, SharedMemoryDROP, ContainerDROP, AppDROP, DirectoryContainer from dlg.common import Categories +from dlg.apps.simple import RandomArrayApp # Used in the textual representation of the graphs in these tests @@ -165,4 +166,21 @@ def test_namedPorts(self): # dropSpecs = graph_loader.loadDropSpecs(graphSpec) a = graph_loader.createGraphFromDropSpecList(graphSpec) dummy = a - \ No newline at end of file + + def test_applicationArgs(self): + """ + Use a graph with applicationArgs and make sure applications see their + arguments + """ + with pkg_resources.resource_stream( + "test", "graphs/application_args.graph" + ) as f: # @UndefinedVariable + graphSpec = json.load(f) + graph = graph_loader.createGraphFromDropSpecList(graphSpec) + app = graph[0] + self.assertEqual(app.__class__, RandomArrayApp) + self.assertEqual(app.size, 50) + self.assertEqual(app.integer, True) + self.assertEqual(app.low, 34) + self.assertEqual(app.high, 3456) +