Skip to content

Commit

Permalink
Addition of workspace sub to linear studies. (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankD412 committed Jun 1, 2018
1 parent 5096749 commit a872ecf
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion maestrowf/datastructures/core/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,18 @@ def _setup_linear(self):
:returns: The path to the study's global workspace and an
ExecutionGraph based on linear steps in the study.
"""
# Management structures
# The workspace used by each step.
workspaces = {SOURCE: self._out_path}

# Construct ExecutionGraph
dag = ExecutionGraph(
submission_attempts=self._submission_attempts,
submission_throttle=self._submission_throttle,
use_tmp=self._use_tmp)
dag.add_description(**self.description)
# Items to store that should be reset.
logger.info("==================================================\n"
logger.info("\n==================================================\n"
"Constructing linear study '%s'\n"
"==================================================\n",
self.name
Expand All @@ -655,8 +659,21 @@ def _setup_linear(self):
else:
rlimit = 0

cmd = node.run["cmd"]
logger.info("Searching for workspaces...\ncmd = %s", cmd)
used_spaces = re.findall(WSREGEX, cmd)
for match in used_spaces:
# In this case we don't need to look for any parameters, or
# combination depdendent ("funnel") steps. It's a simple sub.
logger.info("Workspace found -- %s", match)
workspace_var = "$({}.workspace)".format(match)
ws = workspaces[match]
cmd = cmd.replace(workspace_var, ws)
node.run["cmd"] = cmd

# Add the step
ws = make_safe_path(self._out_path, step)
workspaces[step] = ws
dag.add_step(step, node, ws, rlimit)
# If the node does not depend on any other steps, make it so that
# if connects to SOURCE.
Expand Down

0 comments on commit a872ecf

Please sign in to comment.