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

first attempt at complet log file refactor

parent ab763703
No related branches found
No related tags found
1 merge request!29Restructure log location
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
...@@ -82,7 +82,7 @@ def create_log_file_names( ...@@ -82,7 +82,7 @@ def create_log_file_names(
toolchain : str toolchain : str
toolchain name (only for build log file) toolchain name (only for build log file)
returns : tuple returns : tuple
tuple containing the strings of installer and build log file names tuple containing installer_log_file, build_log_file, file names
""" """
installer_log_file = config_vars["installer_log_template"].substitute( installer_log_file = config_vars["installer_log_template"].substitute(
mpsd_release=mpsd_release, mpsd_release=mpsd_release,
...@@ -631,7 +631,7 @@ def install_environment( ...@@ -631,7 +631,7 @@ def install_environment(
# Set required variables # Set required variables
release_base_dir = script_dir / mpsd_release release_base_dir = script_dir / mpsd_release
mpsd_microarch = get_native_microarchitecture()
toolchain_dir = release_base_dir / mpsd_microarch toolchain_dir = release_base_dir / mpsd_microarch
toolchain_dir.mkdir(parents=True, exist_ok=True) toolchain_dir.mkdir(parents=True, exist_ok=True)
spack_setup_script = release_base_dir / "spack-environments" / "spack_setup.sh" spack_setup_script = release_base_dir / "spack-environments" / "spack_setup.sh"
...@@ -667,9 +667,11 @@ def install_environment( ...@@ -667,9 +667,11 @@ def install_environment(
if not os.path.exists("logs"): if not os.path.exists("logs"):
os.mkdir("logs") os.mkdir("logs")
for toolchain in toolchains: for toolchain in toolchains:
# Set the install log file name to config_vars["install_log_file"] # Set the install log file name from create_log_file_names
# and replace _toolchains_ with the toolchain name and _, build_log_file_name = create_log_file_names(
# _mpsd_spack_ver_ with mpsd_release mpsd_release, mpsd_microarch, "install", toolchain=toolchain
)
build_log_file = toolchain_dir / "logs" / build_log_file_name
logging.info(f"Installing toolchain {toolchain} to {toolchain_dir}") logging.info(f"Installing toolchain {toolchain} to {toolchain_dir}")
...@@ -677,7 +679,7 @@ def install_environment( ...@@ -677,7 +679,7 @@ def install_environment(
setup_log_cmd( setup_log_cmd(
mpsd_release, mpsd_release,
script_dir, script_dir,
msg=f"installing {toolchain} and logging at {install_log_file}", msg=f"installing {toolchain} and logging at {build_log_file}",
) )
setup_log_cmd( setup_log_cmd(
mpsd_release, mpsd_release,
...@@ -689,7 +691,7 @@ def install_environment( ...@@ -689,7 +691,7 @@ def install_environment(
) )
run( run(
f"bash {spack_setup_script} {' '.join(install_flags)} {toolchain} 2>&1 " f"bash {spack_setup_script} {' '.join(install_flags)} {toolchain} 2>&1 "
f"| tee -a {install_log_file} ", f"| tee -a {build_log_file} ",
shell=True, shell=True,
check=True, check=True,
) )
...@@ -813,7 +815,6 @@ def main(): ...@@ -813,7 +815,6 @@ def main():
set_up_logging(args.loglevel, installer_log_file) set_up_logging(args.loglevel, installer_log_file)
# Check the command and run related function # Check the command and run related function
if args.action == "remove": if args.action == "remove":
remove_environment(args.release, args.toolchains, script_dir) remove_environment(args.release, args.toolchains, script_dir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment