Skip to content

Commit

Permalink
Refactoring of Application Parameters to Application Arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed Feb 7, 2022
1 parent cc1e75f commit e7a7cfa
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 125 deletions.
6 changes: 3 additions & 3 deletions OpenAPI/tests/test.graph
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -306,7 +306,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -388,7 +388,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down
4 changes: 2 additions & 2 deletions daliuge-engine/dlg/apps/bash_shell_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def initialize(self, **kwargs):
self._inputRedirect = self._getArg(kwargs, "input_redirection", "")
self._outputRedirect = self._getArg(kwargs, "output_redirection", "")
self._cmdLineArgs = self._getArg(kwargs, "command_line_arguments", "")
self._applicationParams = self._getArg(kwargs, "applicationParams", {})
self._applicationArgs = self._getArg(kwargs, "applicationArgs", {})
self._argumentPrefix = self._getArg(kwargs, "argumentPrefix", "--")
self._paramValueSeparator = self._getArg(kwargs, \
"paramValueSeparator", " ")
Expand Down Expand Up @@ -197,7 +197,7 @@ def _run_bash(self, inputs, outputs, stdin=None, stdout=subprocess.PIPE):
session_id = (
self._dlg_session.sessionId if self._dlg_session is not None else ""
)
argumentString = droputils.serialize_applicationParams(self._applicationParams, \
argumentString = droputils.serialize_applicationArgs(self._applicationArgs, \
self._argumentPrefix, self._paramValueSeparator)
# complete command including all additional parameters and optional redirects
cmd = f"{self.command} {argumentString} {self._cmdLineArgs} "
Expand Down
6 changes: 3 additions & 3 deletions daliuge-engine/dlg/apps/dockerapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ def initialize(self, **kwargs):
logger.warning(
"No command specified. Assume that a default command is executed in the container"
)
# The above also means that we can't pass applicationParams
# The above also means that we can't pass applicationArgs
# raise InvalidDropException(
# self, "No command specified, cannot create DockerApp")
else:
self._applicationParams = self._getArg(kwargs, "applicationParams", {})
self._applicationArgs = self._getArg(kwargs, "applicationArgs", {})

# construct the actual command line from all application parameters
argumentPrefix = self._getArg(kwargs, "argumentPrefix", "--")
argumentString = droputils.serialize_applicationParams(self._applicationParams, \
argumentString = droputils.serialize_applicationArgs(self._applicationArgs, \
argumentPrefix)
self._command = f"{self._command} {argumentString}"

Expand Down
10 changes: 5 additions & 5 deletions daliuge-engine/dlg/droputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ def replace_dataurl_placeholders(cmd, inputs, outputs):

return cmd

def serialize_applicationParams(applicationParams, prefix='--', separator=' '):
def serialize_applicationArgs(applicationArgs, prefix='--', separator=' '):
"""
Unpacks the applicationParams dictionary and returns a string
Unpacks the applicationArgs dictionary and returns a string
that can be used as command line parameters.
"""
if not isinstance(applicationParams, dict):
logger.info("applicationParams are not passed as a dict. Ignored!")
if not isinstance(applicationArgs, dict):
logger.info("applicationArgs are not passed as a dict. Ignored!")
# construct the actual command line from all application parameters
args = []

for (name, value) in applicationParams.items():
for (name, value) in applicationArgs.items():
if value in [None, False, ""]:
continue
elif value is True:
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/lalo/A
Original file line number Diff line number Diff line change
@@ -1 +1 @@
�����x
x���D
2 changes: 1 addition & 1 deletion daliuge-engine/lalo/C
Original file line number Diff line number Diff line change
@@ -1 +1 @@
�����x
x���D
6 changes: 3 additions & 3 deletions daliuge-engine/test/graphs/ddTest.graph
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"command_line_arguments": "",
"paramValueSeparator": "=",
"argumentPrefix": "",
"applicationParams": {
"applicationArgs": {
"if": "%i0",
"of": "%o0",
"count": 10,
Expand Down Expand Up @@ -50,7 +50,7 @@
"group_end": false,
"filepath": "",
"dirname": "",
"applicationParams": {},
"applicationArgs": {},
"iid": "0",
"lg_key": -3,
"dt": "File",
Expand All @@ -75,7 +75,7 @@
"group_end": false,
"filepath": "",
"dirname": "",
"applicationParams": {},
"applicationArgs": {},
"iid": "0",
"lg_key": -4,
"dt": "File",
Expand Down
8 changes: 4 additions & 4 deletions daliuge-translator/dlg/dropmake/pg_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ def _update_key_value_attributes(self, kwargs):
# The field to be used is not the text, but the name field
self.jd[je["name"]] = je["value"]
kwargs[je["name"]] = je["value"]
kwargs["applicationParams"] = {} # make sure the dict always exists downstream
if "applicationParams" in self.jd: # and fill it if provided
for je in self.jd["applicationParams"]:
kwargs["applicationArgs"] = {} # make sure the dict always exists downstream
if "applicationArgs" in self.jd: # and fill it if provided
for je in self.jd["applicationArgs"]:
self.jd[je["name"]] = je["value"]
kwargs["applicationParams"][je["name"]] = je["value"]
kwargs["applicationArgs"][je["name"]] = je["value"]
for i in range(10):
k = "Arg%02d" % (i + 1)
if k not in self.jd:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
"nodeDataArray": [
{
"applicationParams": [],
"applicationArgs": [],
"category": "PythonApp",
"collapsed": false,
"color": "#0059a5",
Expand Down Expand Up @@ -154,7 +154,7 @@
"y": 563
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "SharedMemory",
"collapsed": false,
"color": "#2c2c2c",
Expand Down Expand Up @@ -229,7 +229,7 @@
"y": 565
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "PythonApp",
"collapsed": false,
"color": "#0059a5",
Expand Down Expand Up @@ -324,7 +324,7 @@
"y": 395
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "PythonApp",
"collapsed": false,
"color": "#0059a5",
Expand Down Expand Up @@ -419,7 +419,7 @@
"y": 653
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "PythonApp",
"collapsed": false,
"color": "#0059a5",
Expand Down Expand Up @@ -514,7 +514,7 @@
"y": 525
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "SharedMemory",
"collapsed": false,
"color": "#2c2c2c",
Expand Down Expand Up @@ -580,7 +580,7 @@
"y": 384
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "SharedMemory",
"collapsed": false,
"color": "#2c2c2c",
Expand Down Expand Up @@ -646,7 +646,7 @@
"y": 532
},
{
"applicationParams": [],
"applicationArgs": [],
"category": "SharedMemory",
"collapsed": false,
"color": "#2c2c2c",
Expand Down
26 changes: 13 additions & 13 deletions daliuge-translator/test/dropmake/logical_graphs/eagle_gather.graph
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -175,7 +175,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [
{
"text": "Execution time",
Expand Down Expand Up @@ -499,7 +499,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -582,7 +582,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -665,7 +665,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -857,7 +857,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -969,7 +969,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -1059,7 +1059,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [
{
"text": "Execution time",
Expand Down Expand Up @@ -1242,7 +1242,7 @@
"inputLocalPorts": [],
"outputLocalPorts": [],
"fields": [],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -1354,7 +1354,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -1547,7 +1547,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -1630,7 +1630,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down Expand Up @@ -1713,7 +1713,7 @@
"precious": false
}
],
"applicationParams": [],
"applicationArgs": [],
"inputAppFields": [],
"outputAppFields": [],
"exitAppFields": [],
Expand Down
Loading

0 comments on commit e7a7cfa

Please sign in to comment.