Skip to content

Commit e32a3c6

Browse files
committed
Fix bugs and change toolchain family compatibility to toolchainversion_toolchainname for helpful sorting
1 parent cbcf373 commit e32a3c6

2 files changed

Lines changed: 28 additions & 23 deletions

File tree

scripts/generate_data_files.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ def suppress_stdout():
4848

4949
def module_dict_from_module_string(module):
5050
module_name, module_version = module.split("/", 1)
51+
module_dict = {"module_name": module_name, "module_version": module_version, "full_module_name": module}
5152

52-
return {"module_name": module_name, "module_version": module_version}
53+
return module_dict
5354

54-
def load_and_list_modules(module_name):
55+
def load_and_list_modules(full_module_name):
5556
"""
5657
Run `module load <name>` and `module list` inside a subshell.
5758
Returns the list of loaded modules visible inside that subshell.
@@ -60,14 +61,14 @@ def load_and_list_modules(module_name):
6061

6162
# Run as one shell script so the same session is used
6263
cmd = f"""
63-
module load {module_name} || exit 1
64+
module load {full_module_name} || exit 1
6465
module --terse list 2>&1
6566
"""
6667

6768
result = subprocess.run(["bash", "-c", cmd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
6869

6970
if result.returncode != 0:
70-
raise RuntimeError(f"Failed to load module '{module_name}':\n{result.stdout}")
71+
raise RuntimeError(f"Failed to load module '{full_module_name}':\n{result.stdout}")
7172

7273
# Parse module list output
7374
modules = [
@@ -79,18 +80,18 @@ def load_and_list_modules(module_name):
7980
# Filter out the modules we expect to be loaded
8081
eessi_extend_module_name = "EESSI-extend"
8182
eb_module_name = "EasyBuild"
82-
if module_name.startswith(f"{eessi_extend_module_name}/"):
83+
if full_module_name.startswith(f"{eessi_extend_module_name}/"):
8384
# Don't filter anything
8485
pass
85-
elif module_name.startswith(f"{eb_module_name}/"):
86+
elif full_module_name.startswith(f"{eb_module_name}/"):
8687
# Filter EESSI-extend
87-
modules = [module for module in modules if module["name"] != eessi_extend_module_name]
88+
modules = [module for module in modules if module["module_name"] != eessi_extend_module_name]
8889
else:
8990
# Filter EESSI-extend and EasyBuild
9091
modules = [
9192
module
9293
for module in modules
93-
if module["name"] != eessi_extend_module_name and module["name"] != eb_module_name
94+
if module["module_name"] != eessi_extend_module_name and module["module_name"] != eb_module_name
9495
]
9596

9697
return modules
@@ -217,7 +218,9 @@ def collect_eb_files(base_path):
217218
# Store the toolchain hierarchies supported by the EESSI version
218219
eessi_software["eessi_version"][eessi_version]["toolchain_hierarchy"] = {}
219220
for top_level_toolchain in EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS[eessi_version]:
220-
toolchain_family = f"{top_level_toolchain['name']}_{top_level_toolchain['version']}"
221+
# versions are typically 2024a/2024b etc. for top level toolchains
222+
# so let's use that to make sorting easy
223+
toolchain_family = f"{top_level_toolchain['version']}_{top_level_toolchain['name']}"
221224
# Get the hierarchy and always add the system toolchain
222225
eessi_software["eessi_version"][eessi_version]["toolchain_hierarchy"][toolchain_family] = [
223226
{"name": "system", "version": "system"}
@@ -249,6 +252,7 @@ def collect_eb_files(base_path):
249252
]
250253
shutil.rmtree(easyblocks_dir)
251254

255+
# Store everything we now know about the installation as a dict
252256
# Use the path as the key since we know it is unique
253257
eessi_software["eessi_version"][eessi_version][file] = parsed_ec["ec"].asdict()
254258
eessi_software["eessi_version"][eessi_version][file]["mtime"] = os.path.getmtime(file)
@@ -263,11 +267,8 @@ def collect_eb_files(base_path):
263267
eessi_software["eessi_version"][eessi_version].pop(file)
264268
continue
265269

266-
# Store everything we now know about the installation as a dict
267270
# Add important data that is related to the module environment
268271
eessi_software["eessi_version"][eessi_version][file]["module"] = module_dict_from_module_string(parsed_ec["full_mod_name"])
269-
eessi_software["eessi_version"][eessi_version][file]["full_mod_name"] = parsed_ec["full_mod_name"]
270-
eessi_software["eessi_version"][eessi_version][file]["short_mod_name"] = parsed_ec["short_mod_name"]
271272
# Retain the easyblocks used so we can use a heuristic to figure out the type of extensions (R, Python, Perl)
272273
eessi_software["eessi_version"][eessi_version][file]["easyblocks"] = easyblocks_used
273274

scripts/process_eessi_software_metadata.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
]
2626

2727
TOOLCHAIN_FAMILIES = [
28-
"foss_2025b",
29-
"foss_2025a",
30-
"foss_2024a",
31-
"foss_2023b",
32-
"foss_2023a",
33-
"foss_2022b",
28+
"2025b_foss",
29+
"2025a_foss",
30+
"2024a_foss",
31+
"2023b_foss",
32+
"2023a_foss",
33+
"2022b_foss",
3434
]
3535

3636

@@ -47,7 +47,7 @@ def get_software_information_by_filename(file_metadata, original_path=None, tool
4747
"toolchain_families_compatibility": [
4848
key for key in toolchain_families.keys() if file_metadata["toolchain"] in toolchain_families[key]
4949
],
50-
"modulename": file_metadata["short_mod_name"],
50+
"module": file_metadata["module"],
5151
"required_modules": file_metadata["required_modules"],
5252
}
5353

@@ -65,7 +65,7 @@ def get_software_information_by_filename(file_metadata, original_path=None, tool
6565

6666
# 2) Construct the modulefile path
6767
before_arch, _, _ = original_path.partition(detected_arch)
68-
modulefile = before_arch + detected_arch + "/modules/all/" + file_metadata["short_mod_name"] + '.lua'
68+
modulefile = before_arch + detected_arch + "/modules/all/" + file_metadata["module"]["full_module_name"] + '.lua'
6969
spider_cache = before_arch + detected_arch + "/.lmod/cache/spiderT.lua"
7070

7171
# 3) Substitute each architecture and test module file existence in spider cache
@@ -161,11 +161,11 @@ def get_software_information_by_filename(file_metadata, original_path=None, tool
161161
version_dict = copy.deepcopy(base_version_dict)
162162
version_dict["version"] = component[1]
163163
version_dict["versionsuffix"] = ""
164-
version_dict["type"] = "Component"
164+
# version_dict["type"] = "Component"
165165
version_dict["parent_software"] = {
166166
"name": file_metadata["name"],
167167
"version": file_metadata["version"],
168-
"version": file_metadata["versionsuffix"],
168+
"versionsuffix": file_metadata["versionsuffix"],
169169
}
170170
version_dict["description"] = (
171171
f"""{component[0]} is a component included in the software module for {version_dict['parent_software']['name']}"""
@@ -228,6 +228,7 @@ def get_all_software(eessi_files_by_eessi_version):
228228
for version in all_software_information[software]["versions"]:
229229
if toolchain_family in version["toolchain_families_compatibility"]:
230230
reference_version = version
231+
break
231232
if reference_version is None:
232233
raise ValueError(f"No toolchain compatibility in {all_software_information[software]}")
233234
for top_level_info in top_level_info_list + ["description"]:
@@ -305,7 +306,10 @@ def main():
305306
# - versionsuffix
306307
# - cpu_arch (list)
307308
# - gpu_arch (list, empty for now)
308-
# - module_file
309+
# - module
310+
# - module_name
311+
# - module_version
312+
# - full_module_name
309313
# - required_modules (list of modules)
310314
base_json_metadata = {"timestamp": software_metadata["timestamp"]}
311315
eessi_versions = software_metadata["eessi_version"].keys()

0 commit comments

Comments
 (0)