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

first attempt at status command

parent 9f7fb31d
No related branches found
No related tags found
1 merge request!41Status command
Pipeline #370456 failed
......@@ -12,6 +12,7 @@ import time
from pathlib import Path
from typing import List, Tuple, Union
import re
import json
# If 'rich' is available ("pip install rich" or "apt-get install python3-rich"),
# then use coloured output, otherwise proceed as before
......@@ -834,16 +835,30 @@ def environment_status(mpsd_release, script_dir):
# raise NotImplementedError(msg)
release_base_dir = script_dir / mpsd_release
os.environ.get("MPSD_OS", "UNKNOWN_OS")
microarch = get_native_microarchitecture()
toolchain_dir = release_base_dir / microarch
sys_microarch = get_native_microarchitecture()
toolchain_dir = release_base_dir / sys_microarch
spack_dir = toolchain_dir / "spack"
lmod_toolchain_dir = release_base_dir / sys_microarch / "lmod" / "Core" / "toolchains"
if not spack_dir.exists():
raise ValueError(
f"Release {mpsd_release} has not been completly installed yet"
", try reinstalling it (spack directory not found)"
)
with os_chdir(spack_dir):
pass
# find all folders for all microarch in the release directory except for the blacklisted folder
black_listed_microarchs = ["spack-environments", "logs"]
list_of_microarchs = os.listdir(release_base_dir)
list_of_microarchs.remove(black_listed_microarchs)
toolchain_map = {}
for microarch in list_of_microarchs:
# get a list of all the toolchains in the microarch
possible_toolchains = (release_base_dir/microarch).glob("lmod/Core/toolchains/*.lua")
# append toolchain which is the name of the file without the .lua extension
toolchain_map[microarch] = [toolchain.stem for toolchain in possible_toolchains]
# pretty print the toolchain map
print(json.dumps(toolchain_map, indent=4, sort_keys=True))
def main():
......
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