Skip to content
Snippets Groups Projects
Commit 50214580 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

update log message

parent 4f68c8c6
No related branches found
No related tags found
1 merge request!77Skip logging script commit hash
......@@ -580,10 +580,9 @@ def record_script_execution_summary(
"""
# Write to the log file with the following format
# --------------------------------------------------
# 2023-02-29T23:32:01, install-software-environment.py --release 23b --install ALL
# Software environment installer branch: script_branch (commit hash: \
# script_commit_hash)
# Spack environments branch: dev-23a (commit hash: spe_commit_hash)
# 2023-06-20T15:30:37.965370, src/mpsd_software_manager/mpsd_software.py prepare dev-23a
# MPSD Software manager version: 2023.6.16
# Spack environments branch: dev-23a (commit hash: 8eac43476b2fd9a3a044f5562f3f7c2bccfe384a)
# MSGs
with os_chdir(root_dir):
with open(config_vars["cmd_log_file"], "a") as f:
......@@ -597,39 +596,15 @@ def record_script_execution_summary(
# Gather data to log
# call statement:
cmd_line = " ".join(sys.argv)
# script branch and commit hash
with os_chdir(root_dir):
try:
script_branch = (
run(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
stdout=subprocess.PIPE,
check=True,
)
.stdout.decode()
.strip()
)
script_commit_hash = (
run(
["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE,
check=True,
)
.stdout.decode()
.strip()
)
except subprocess.CalledProcessError:
script_branch = "unknown"
script_commit_hash = "unknown"
# spack-environments branch and commit hash from kwargs
spe_branch = kwargs.get("spe_branch", None)
spe_commit_hash = kwargs.get("spe_commit_hash", None)
# Write to log file
f.write(f"{datetime.datetime.now().isoformat()}, {cmd_line}\n")
# logs script version
f.write(
f"Software environment installer branch: {script_branch} "
f"(commit hash: {script_commit_hash})\n"
f"MPSD Software manager version: {__version__}\n"
)
f.write(
f"Spack environments branch: {spe_branch} "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment