Skip to content

Commit

Permalink
Fix dryrun mode broken due to the introduction of -p #976
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Jun 1, 2018
1 parent f2d6843 commit aac8ef5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/sos/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def workflow_status(workflow):
'{("-s " + sig_mode) if sig_mode not in ("", "default") else ""} '
'{("-q " + default_queue) if default_queue else ""} '
'{("-d " + output_dag) if output_dag not in ("", None) else ""} '
'{("-p " + output_report) if output_report not in ("", None) else ""} '
'{("-b " + " ".join(bin_dirs)) if bin_dirs and bin_dirs != ["~/.sos/bin"] else ""} '
'{("-j " + str(max_procs)) if max_procs != 4 else ""} '
'{("-J " + str(max_running_jobs)) if max_running_jobs else ""} '
Expand Down Expand Up @@ -570,6 +571,8 @@ def cmd_resume(args, workflow_args):
args.__queue__ = None if res['default_queue'] == '' else res['default_queue']
args.__dag__ = None if res['output_dag'] == '-' else (
'' if res['output_dag'] is None else res['output_dag'])
args.__report__ = None if res['output_report'] == '-' else (
'' if res['output_report'] is None else res['output_report'])
args.__targets__ = res['targets']
args.script = res['script']
args.workflow = res['workflow']
Expand Down Expand Up @@ -636,6 +639,7 @@ def cmd_dryrun(args, workflow_args):
args.__max_procs__ = 1
args.__max_running_jobs__ = 1
args.dryrun = True
args.__report__ = None
args.__wait__ = True
args.__no_wait__ = False
args.__bin_dirs__ = []
Expand Down
10 changes: 8 additions & 2 deletions src/sos/workflow_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,15 @@ def i_am():
env.logger.warning(
f'Failed to clear workflow status file: {e}')
self.save_workflow_signature(dag)
if self.completed["__step_completed__"] == 0:
sts = 'ignored'
elif env.config["run_mode"] == 'dryrun':
sts = 'tested successfully'
else:
std = 'executed successfully'
env.logger.info(
f'Workflow {self.workflow.name} (ID={self.md5}) is {"executed successfully" if self.completed["__step_completed__"] > 0 else "ignored"} with {self.describe_completed()}.')
if not parent_pipe and env.config['output_report'] and env.sos_dict.get('__workflow_sig__'):
f'Workflow {self.workflow.name} (ID={self.md5}) is {sts} with {self.describe_completed()}.')
if env.config["run_mode"] != 'dryrun' and not parent_pipe and env.config['output_report'] and env.sos_dict.get('__workflow_sig__'):
# if this is the outter most workflow
from .report import render_report
render_report(env.config['output_report'],
Expand Down

0 comments on commit aac8ef5

Please sign in to comment.