Skip to content

Commit

Permalink
Addition of user enabled workspace hashing (#145)
Browse files Browse the repository at this point in the history
* Addition of hashing to Study parameterization.

* Addition of the hashws option to argparse.

* Addition of a warning note for users who use labels in steps.
  • Loading branch information
FrankD412 committed May 28, 2022
1 parent fb638c0 commit 22ab603
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
17 changes: 6 additions & 11 deletions maestrowf/datastructures/core/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ def setup_environment(self):
self.environment.acquire_environment()

def configure_study(self, submission_attempts=1, restart_limit=1,
throttle=0, use_tmp=False, hash_ws=False,
dry_run=False):
throttle=0, use_tmp=False, hash_ws=False):
"""
Perform initial configuration of a study. \
Expand All @@ -418,7 +417,6 @@ def configure_study(self, submission_attempts=1, restart_limit=1,
self._submission_throttle = throttle
self._use_tmp = use_tmp
self._hash_ws = hash_ws
self._dry_run = dry_run

LOGGER.info(
"\n------------------------------------------\n"
Expand All @@ -427,11 +425,9 @@ def configure_study(self, submission_attempts=1, restart_limit=1,
"Submission throttle limit = %d\n"
"Use temporary directory = %s\n"
"Hash workspaces = %s\n"
"Dry run enabled = %s\n"
"Output path = %s\n"
"------------------------------------------",
submission_attempts, restart_limit, throttle,
use_tmp, hash_ws, dry_run, self._out_path
self._out_path, submission_attempts, restart_limit, throttle,
use_tmp, hash_ws
)

self.is_configured = True
Expand Down Expand Up @@ -630,12 +626,11 @@ def _stage(self, dag):
combo_str = combo.get_param_string(self.used_params[step])
if self._hash_ws:
workspace = make_safe_path(
self._out_path,
*[step, md5(combo_str).hexdigest()])
self._out_path, step, md5(combo_str).hexdigest())
else:
workspace = \
make_safe_path(self._out_path, *[step, combo_str])
LOGGER.debug("Workspace: %s", workspace)
make_safe_path(self._out_path, step, combo_str)
logger.debug("Workspace: %s", workspace)
combo_str = "{}_{}".format(step, combo_str)
self.workspaces[combo_str] = workspace

Expand Down
9 changes: 6 additions & 3 deletions maestrowf/maestro.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ def run_study(args):
study.setup_workspace()
study.configure_study(
throttle=args.throttle, submission_attempts=args.attempts,
restart_limit=args.rlimit, use_tmp=args.usetmp, hash_ws=args.hashws,
dry_run=args.dry)
study.setup_environment()
restart_limit=args.rlimit, use_tmp=args.usetmp, hash_ws=args.hashws)

# Stage the study.
path, exec_dag = study.stage()
# Write metadata
study.store_metadata()

if args.dry:
# If performing a dry run, drive sleep time down to generate scripts.
Expand Down

0 comments on commit 22ab603

Please sign in to comment.