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

simplify create_log_file_names using fsrings

parent c3b62aab
No related branches found
No related tags found
2 merge requests!39Split logfile templates usage,!29Restructure log location
Pipeline #370272 passed
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
...@@ -12,7 +12,6 @@ import time ...@@ -12,7 +12,6 @@ import time
from pathlib import Path from pathlib import Path
from typing import List, Tuple, Union from typing import List, Tuple, Union
import re import re
from string import Template
# If 'rich' is available ("pip install rich" or "apt-get install python3-rich"), # If 'rich' is available ("pip install rich" or "apt-get install python3-rich"),
# then use coloured output, otherwise proceed as before # then use coloured output, otherwise proceed as before
...@@ -38,14 +37,7 @@ call_date_iso = ( ...@@ -38,14 +37,7 @@ call_date_iso = (
config_vars = { config_vars = {
# kept inside the mpsd_release folder # kept inside the mpsd_release folder
"cmd_log_file": "script_execution_summary.log", "cmd_log_file": "script_execution_summary.log",
# Placeholder installer log file name, placed at mpsd_microarch/logs # Metadata tags
"installer_log_template": Template(
"${mpsd_release}_${mpsd_microarch}_${date}_APEX_${action}.log"
),
# Placeholder build log file name, placed at mpsd_microarch/logs
"build_log_template": Template(
"${mpsd_release}_${mpsd_microarch}_${date}_BUILD_${toolchain}_${action}.log"
),
"metadata_tag_open": "!<meta>", "metadata_tag_open": "!<meta>",
"metadata_tag_close": "</meta>!", "metadata_tag_close": "</meta>!",
"spack_environments_repo": "https://gitlab.gwdg.de/mpsd-cs/spack-environments.git", "spack_environments_repo": "https://gitlab.gwdg.de/mpsd-cs/spack-environments.git",
...@@ -96,20 +88,16 @@ def create_log_file_names( ...@@ -96,20 +88,16 @@ def create_log_file_names(
if toolchain: if toolchain:
# if toolchain is given, then we build the build_log_file_name # if toolchain is given, then we build the build_log_file_name
if action in ["install", "remove"]: if action in ["install", "remove"]:
log_template = config_vars["build_log_template"] log_file_name = (
f"{mpsd_release}_{mpsd_microarch}_{date}_BUILD_{toolchain}_{action}.log"
)
else: else:
return None return None
else: else:
# if toolchain is not given, then we build the installer_log_file_name # if toolchain is not given, then we build the installer_log_file_name
log_template = config_vars["installer_log_template"] log_file_name = f"{mpsd_release}_{mpsd_microarch}_{date}_APEX_{action}.log"
return log_template.substitute( return log_file_name
mpsd_release=mpsd_release,
mpsd_microarch=mpsd_microarch,
date=date,
action=action,
toolchain=toolchain,
)
def log_metadata(key: str, value: str) -> None: def log_metadata(key: str, value: str) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment