Skip to content

Commit

Permalink
Changed trace output to mention directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Micket committed Apr 14, 2024
1 parent e6ccf9e commit 5ae9be7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions easybuild/tools/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def to_cmd_str(cmd):
else:
cmd_err_fp = None
else:
cmd_out_fp, cmd_err_fp = None, None
tmpdir, cmd_out_fp, cmd_err_fp = None, None, None

interactive = bool(qa_patterns)
interactive_msg = 'interactive ' if interactive else ''
Expand All @@ -390,7 +390,7 @@ def to_cmd_str(cmd):

start_time = datetime.now()
if not hidden:
_cmd_trace_msg(cmd_str, start_time, work_dir, stdin, cmd_out_fp, cmd_err_fp, thread_id, interactive=interactive)
_cmd_trace_msg(cmd_str, start_time, work_dir, stdin, tmpdir, thread_id, interactive=interactive)

if stream_output:
print_msg(f"(streaming) output for command '{cmd_str}':")
Expand Down Expand Up @@ -551,16 +551,15 @@ def to_cmd_str(cmd):
return res


def _cmd_trace_msg(cmd, start_time, work_dir, stdin, cmd_out_fp, cmd_err_fp, thread_id, interactive=False):
def _cmd_trace_msg(cmd, start_time, work_dir, stdin, tmpdir, thread_id, interactive=False):
"""
Helper function to construct and print trace message for command being run
:param cmd: command being run
:param start_time: datetime object indicating when command was started
:param work_dir: path of working directory in which command is run
:param stdin: stdin input value for command
:param cmd_out_fp: path to output file for command
:param cmd_err_fp: path to errors/warnings output file for command
:param tmpdir: path to temporary output directory for command
:param thread_id: thread ID (None when not running shell command asynchronously)
:param interactive: boolean indicating whether it is an interactive command, or not
"""
Expand All @@ -580,10 +579,8 @@ def _cmd_trace_msg(cmd, start_time, work_dir, stdin, cmd_out_fp, cmd_err_fp, thr
]
if stdin:
lines.append(f"\t[input: {stdin}]")
if cmd_out_fp:
lines.append(f"\t[output saved to {cmd_out_fp}]")
if cmd_err_fp:
lines.append(f"\t[errors/warnings saved to {cmd_err_fp}]")
if tmpdir:
lines.append(f"\t[output and state saved to {tmpdir}]")

trace_msg('\n'.join(lines))

Expand Down

0 comments on commit 5ae9be7

Please sign in to comment.