Skip to content

Commit

Permalink
Correct the inability of accessing the study output root directory. (#…
Browse files Browse the repository at this point in the history
…103)

* Fixed a bug with removing of environment variables.

* Add the OUTPUT_PATH to the environment.

* Correction of a logger message.

* Tweak to have StepRecords point to WORKSPACE

* Tweaks to examples to include WORKSPACE keyword.
  • Loading branch information
FrankD412 committed May 22, 2018
1 parent faf9648 commit 420fe48
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion maestrowf/datastructures/core/executiongraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def __init__(self, workspace, step, **kwargs):
tmp_dir: A provided temp directory to write scripts to instead of step
workspace.
"""
self.workspace = Variable("OUTPUT_PATH", workspace)
self.workspace = Variable("WORKSPACE", workspace)
step.run["cmd"] = self.workspace.substitute(step.run["cmd"])

self.jobid = kwargs.get("jobid", [])
self.script = kwargs.get("script", "")
Expand Down
2 changes: 1 addition & 1 deletion maestrowf/datastructures/core/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def _setup_parameterized(self):
for ws in used_spaces:
if ws not in used_params:
msg = "Workspace for '{}' is being used before it would" \
"be generated.".format(ws)
" be generated.".format(ws)
logger.error(msg)
raise Exception(msg)

Expand Down
7 changes: 7 additions & 0 deletions maestrowf/datastructures/core/studyenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,23 @@ def remove(self, key):
:returns: The environment object labeled by key.
"""
logger.debug("Looking to remove '%s'...", key)

if key not in self._names:
return None

_ = self.dependencies.pop(key, None)
if _ is not None:
self._names.remove(key)
return _

_ = self.substitutions.pop(key, None)
if _ is not None:
self._names.remove(key)
return _

_ = self.labels.pop(key, None)
if _ is not None:
self._names.remove(key)
return _

logger.debug("'%s' not found -- \n%s", key, self)
Expand Down
1 change: 1 addition & 0 deletions maestrowf/maestro.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def run_study(args):
time.strftime("%Y%m%d-%H%M%S")
)
output_path = make_safe_path(out_dir, out_name)
environment.add(Variable("OUTPUT_PATH", output_path))

# Now that we know outpath, set up logging.
setup_logging(args, output_path, spec.name)
Expand Down
4 changes: 2 additions & 2 deletions samples/lulesh/lulesh_sample1_macosx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ study:
run:
cmd: |
curl -L -o lulesh.tar $(LULESH_URL)
mkdir $(OUTPUT_PATH)/lulesh
tar -xf lulesh.tar -C $(OUTPUT_PATH)/lulesh
mkdir $(WORKSPACE)/lulesh
tar -xf lulesh.tar -C $(WORKSPACE)/lulesh
depends: []

- name: make-lulesh
Expand Down
4 changes: 2 additions & 2 deletions samples/lulesh/lulesh_sample1_unix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ study:
run:
cmd: |
curl -L -o lulesh.tar $(LULESH_URL)
mkdir $(OUTPUT_PATH)/lulesh
tar -xf lulesh.tar -C $(OUTPUT_PATH)/lulesh
mkdir $(WORKSPACE)/lulesh
tar -xf lulesh.tar -C $(WORKSPACE)/lulesh
depends: []

- name: make-lulesh
Expand Down

0 comments on commit 420fe48

Please sign in to comment.