From 6b2cd03598d8c83aa1f687a10891bdbf7f867dbb Mon Sep 17 00:00:00 2001 From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de> Date: Thu, 4 May 2023 10:21:28 +0200 Subject: [PATCH] add optional msg to cmd_log --- install-mpsd-software-environment.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/install-mpsd-software-environment.py b/install-mpsd-software-environment.py index 0165909..bcfb1de 100755 --- a/install-mpsd-software-environment.py +++ b/install-mpsd-software-environment.py @@ -49,16 +49,20 @@ def setup_log_cmd(shared_var): # 2023-02-29T23:32:01, install-software-environment.py --release dev-23a --install ALL # Software environment installer branch: script_branch (commit hash: script_commit_hash) # Spack environments branch: dev-23a (commit hash: spe_commit_hash) + # MSGs with open(config_vars['cmd_log_file'], "a") as f: - f.write("-" * 50 + "\n") - cmd_line = " ".join(sys.argv) - f.write(f"{datetime.datetime.now().isoformat()}, {cmd_line}\n") - f.write( - f"Software environment installer branch: {shared_var['script_branch']} (commit hash: {shared_var['script_commit_hash']})\n" - ) - f.write( - f"Spack environments branch: {shared_var['spe_branch']} (commit hash: {shared_var['spe_commit_hash']})\n" - ) + if msg: + f.write(msg + "\n") + else: + f.write("-" * 50 + "\n") + cmd_line = " ".join(sys.argv) + f.write(f"{datetime.datetime.now().isoformat()}, {cmd_line}\n") + f.write( + f"Software environment installer branch: {shared_var['script_branch']} (commit hash: {shared_var['script_commit_hash']})\n" + ) + f.write( + f"Spack environments branch: {shared_var['spe_branch']} (commit hash: {shared_var['spe_commit_hash']})\n" + ) class builder: -- GitLab