Skip to content

Commit

Permalink
Applies workspace substitution to the restart command. (#219)
Browse files Browse the repository at this point in the history
Fixes #217 

* Sub in the new restart command.

* Addition of restart workspaces to sub.

* Fix for WORKSPACE substitutions into restart.

* Correction to override restart instead of cmd.
  • Loading branch information
Francesco Di Natale committed Jan 22, 2020
1 parent d14c670 commit 13beff7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions maestrowf/datastructures/core/executiongraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, workspace, step, **kwargs):
"""
self.workspace = Variable("WORKSPACE", workspace)
step.run["cmd"] = self.workspace.substitute(step.run["cmd"])
step.run["restart"] = self.workspace.substitute(step.run["restart"])

self.jobid = kwargs.get("jobid", [])
self.script = kwargs.get("script", "")
Expand Down
4 changes: 3 additions & 1 deletion maestrowf/datastructures/core/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ def _stage(self, dag):
# Search for workspace matches. These affect the expansion of a
# node because they may use parameters. These are likely to cause
# a node to fall into the 'Parameter Dependent' case.
used_spaces = re.findall(WSREGEX, node.run["cmd"])
used_spaces = re.findall(
WSREGEX, "{} {}".format(node.run["cmd"], node.run["restart"]))
for ws in used_spaces:
if ws not in self.used_params:
msg = "Workspace for '{}' is being used before it would" \
Expand Down Expand Up @@ -571,6 +572,7 @@ def _stage(self, dag):
# here, it's reflected in the ExecutionGraph.
node = copy.deepcopy(node)
node.run["cmd"] = cmd
node.run["restart"] = r_cmd
logger.debug("New cmd = %s", cmd)
logger.debug("New restart = %s", r_cmd)

Expand Down

0 comments on commit 13beff7

Please sign in to comment.