Skip to content

Commit

Permalink
Merge pull request #15 from NREL/gb/logging
Browse files Browse the repository at this point in the history
combined redundant logging messages
  • Loading branch information
grantbuster authored Sep 1, 2023
2 parents 39e94b0 + a61cb66 commit 774a2cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions gaps/cli/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,10 @@ def _kickoff_hpc_job(ctx, cmd, hardware_option, **kwargs):

name = ctx.obj["NAME"]
command = ctx.obj["COMMAND_NAME"]
logger.info("Running %r on HPC with job name %r.", command, name)
logger.debug("Submitting the following command:\n%s", cmd)
out = ctx.obj["MANAGER"].submit(name, cmd=cmd, **kwargs)[0]
id_msg = f" (Job ID #{out})" if out else ""
msg = f"Kicked off job {name!r}{id_msg}"
msg = f"Kicked off {command!r} job {name!r}{id_msg}"

Status.mark_job_as_submitted(
ctx.obj["OUT_DIR"],
Expand Down
7 changes: 3 additions & 4 deletions tests/cli/test_cli_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ def _test_submit(cmd):
kickoff_job(test_ctx, cmd, exec_kwargs)
test_ctx.obj.pop("MANAGER", None)

assert len(cmd_cache) == 2
assert len(cmd_cache) >= 1, str(cmd_cache)
assert_message_was_logged(
"Found extra keys in 'execution_control'! ", "WARNING"
)
assert_message_was_logged("dne_arg", "WARNING")
assert_message_was_logged("Running 'run' on HPC with job name", "INFO")
assert_message_was_logged(test_ctx.obj["NAME"], "INFO")
assert_message_was_logged("Kicked off job")
assert_message_was_logged(test_ctx.obj["NAME"])
assert_message_was_logged("Kicked off ")
assert_message_was_logged("(Job ID #9999)", clear_records=True)
assert len(list(test_ctx.obj["TMP_PATH"].glob("*"))) == 2

Expand Down

0 comments on commit 774a2cf

Please sign in to comment.