From 61602b38393d1d191469884f07d67adf7f88c23a Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Wed, 28 Oct 2026 20:55:37 +0100 Subject: [PATCH 01/10] don't hardcode EESSI version environments --- eessi/testsuite/common_config.py | 37 +++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index c9011713..3d2aa16c 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -1,5 +1,6 @@ import json import os +import subprocess from reframe.core.config import load_config from reframe.core.exceptions import ConfigError @@ -77,6 +78,35 @@ def reframe_version_is_supported(): ]) +def get_available_eessi_versions(): + """ + Query Lmod for the available EESSI versions. + The EESSI modules must already be available (in $MODULEPATH) before running ReFrame. + :return: sorted list of available EESSI versions, e.g. ['2023.06', '2025.06'] + """ + lmod_cmd = os.getenv('LMOD_CMD') + if not lmod_cmd: + raise EESSIError('Environment variable LMOD_CMD is not set: Lmod is required to query the EESSI versions.') + + # EESSI modules may be hidden by the site, so include hidden modules + cmd = [lmod_cmd, 'python', '--show-hidden', '--terse', 'avail', 'EESSI'] + try: + # Lmod prints the output of 'module avail' to stderr + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + except (OSError, subprocess.CalledProcessError) as err: + raise EESSIError(f'Failed to query the available EESSI versions with {cmd}: {err}') from err + + # lines look like 'EESSI/2025.06' or 'EESSI/2025.06 ' + versions = { + line.split()[0].split('/', 1)[1] + for line in result.stderr.splitlines() + if line.startswith('EESSI/') + } + if not versions: + raise EESSIError('No EESSI versions found. Make sure the EESSI modules are available before running ReFrame.') + return sorted(versions) + + def set_common_required_config(site_configuration: dict, set_memory: bool = True, eessi_prepare_cmds=None): """ Update ReFrame configuration file: set common required config options. @@ -87,11 +117,12 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True if not eessi_prepare_cmds: eessi_prepare_cmds = [] + eessi_versions = get_available_eessi_versions() environments = [ - {'name': 'EESSI-2023.06', 'modules': ['EESSI/2023.06'], 'prepare_cmds': eessi_prepare_cmds}, - {'name': 'EESSI-2025.06', 'modules': ['EESSI/2025.06'], 'prepare_cmds': eessi_prepare_cmds}, + {'name': f'EESSI-{version}', 'modules': [f'EESSI/{version}'], 'prepare_cmds': eessi_prepare_cmds} + for version in eessi_versions ] - environs = ['EESSI-2023.06', 'EESSI-2025.06'] + environs = [env['name'] for env in environments] use_nodes_option = True if set_memory: resources_memory = [{ From 09be5188c155843cd8d5d082c7e63bacaf593c13 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Wed, 28 Oct 2026 21:14:54 +0100 Subject: [PATCH 02/10] warn instead of error if no EESSI versions are found --- eessi/testsuite/common_config.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index 3d2aa16c..dcaee3ab 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -103,7 +103,10 @@ def get_available_eessi_versions(): if line.startswith('EESSI/') } if not versions: - raise EESSIError('No EESSI versions found. Make sure the EESSI modules are available before running ReFrame.') + getlogger().warning( + 'No EESSI versions found. If you want to test the EESSI software stack,' + ' make sure the EESSI modules are available before running ReFrame.' + ) return sorted(versions) @@ -136,24 +139,24 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True 'options': ['--gpus-per-node={num_gpus_per_node}'], }] - if 'environments' in site_configuration and site_configuration['environments'] != environments: + if 'environments' not in site_configuration: + site_configuration['environments'] = environments + elif environments and site_configuration['environments'] != environments: msg = f"Appending environments {environments} to the environments already present in the site_configuration" msg += f" ({site_configuration['environments']})" getlogger().info(msg) site_configuration['environments'].extend(environments) - else: - site_configuration['environments'] = environments for system in site_configuration.get('systems', []): for partition in system.get('partitions', []): # Set or overwrite the partition environment - if 'environs' in partition and partition['environs'] != environs: + if 'environs' not in partition: + partition['environs'] = environs + elif environs and partition['environs'] != environs: msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" msg += f" for {system['name']}:{partition['name']}" getlogger().info(msg) partition['environs'].extend(environs) - else: - partition['environs'] = environs # Set or overwrite the 'use_nodes_option' scheduler option, if this is a SLURM-like scheduler if partition['scheduler'] in ['slurm', 'squeue']: From 075dba80db2994e269d6e250ebe72fd598a8a8e7 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Wed, 28 Oct 2026 21:39:19 +0100 Subject: [PATCH 03/10] fix gh workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f195df0a..2765d27f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - name: Run test suite run: | - source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/bash + source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/lmod/bash module load ReFrame reframe --version From 68c46692423e719d181d3cf3b46a34ee156ef5cf Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 11:04:00 +0100 Subject: [PATCH 04/10] add add_eessi_versions param --- config/settings_example.py | 3 +++ eessi/testsuite/common_config.py | 31 ++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/config/settings_example.py b/config/settings_example.py index 7c4ea87d..ba1b7957 100644 --- a/config/settings_example.py +++ b/config/settings_example.py @@ -129,4 +129,7 @@ ] # Set common Slurm config options +# By default, all EESSI versions found by Lmod are added as environments to every partition. Use the +# add_eessi_versions argument to only add specific versions (e.g. add_eessi_versions=['2025.06']), +# or add_eessi_versions=False to define the EESSI environments and partition environs yourself. set_common_required_config(site_configuration, eessi_prepare_cmds=eessi_prepare_cmds) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index dcaee3ab..1cbeb247 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -110,17 +110,32 @@ def get_available_eessi_versions(): return sorted(versions) -def set_common_required_config(site_configuration: dict, set_memory: bool = True, eessi_prepare_cmds=None): +def set_common_required_config(site_configuration: dict, set_memory: bool = True, eessi_prepare_cmds=None, + add_eessi_versions=True): """ Update ReFrame configuration file: set common required config options. Must be called at the end of the site configuration file (below the `site_configuration` dict). :param site_configuration: site configuration dictionary :param set_memory: whether to set memory resources + :param eessi_prepare_cmds: list of prepare commands for the environments created for `add_eessi_versions` + :param add_eessi_versions: EESSI versions to add to the site configuration, each as a ReFrame environment + that is also added to every partition. + True (default): all versions found by Lmod + list of versions: only those versions, e.g. ['2025.06'] + False: add no versions, the site defines its own EESSI environments and partition environs """ if not eessi_prepare_cmds: eessi_prepare_cmds = [] - eessi_versions = get_available_eessi_versions() + if add_eessi_versions is True: + eessi_versions = get_available_eessi_versions() + elif add_eessi_versions is False: + eessi_versions = [] + elif isinstance(add_eessi_versions, (list, tuple)): + eessi_versions = add_eessi_versions + else: + raise EESSIError(f'add_eessi_versions must be True, False or a list of versions, got {add_eessi_versions!r}') + environments = [ {'name': f'EESSI-{version}', 'modules': [f'EESSI/{version}'], 'prepare_cmds': eessi_prepare_cmds} for version in eessi_versions @@ -152,11 +167,13 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True # Set or overwrite the partition environment if 'environs' not in partition: partition['environs'] = environs - elif environs and partition['environs'] != environs: - msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" - msg += f" for {system['name']}:{partition['name']}" - getlogger().info(msg) - partition['environs'].extend(environs) + else: + missing_environs = [env for env in environs if env not in partition['environs']] + if missing_environs: + msg = f"Appending environs {missing_environs} to the existing environs ({partition['environs']})" + msg += f" for {system['name']}:{partition['name']}" + getlogger().info(msg) + partition['environs'].extend(missing_environs) # Set or overwrite the 'use_nodes_option' scheduler option, if this is a SLURM-like scheduler if partition['scheduler'] in ['slurm', 'squeue']: From 2a16faf0aba051c99fa7d58f4c3e425bd937cb33 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 15:46:53 +0100 Subject: [PATCH 05/10] update --- config/settings_example.py | 7 ++++--- eessi/testsuite/common_config.py | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/config/settings_example.py b/config/settings_example.py index ba1b7957..9e65645f 100644 --- a/config/settings_example.py +++ b/config/settings_example.py @@ -129,7 +129,8 @@ ] # Set common Slurm config options -# By default, all EESSI versions found by Lmod are added as environments to every partition. Use the -# add_eessi_versions argument to only add specific versions (e.g. add_eessi_versions=['2025.06']), -# or add_eessi_versions=False to define the EESSI environments and partition environs yourself. +# By default, all EESSI versions found by Lmod are added as environments to every partition, except +# partitions that already list an EESSI environment. Use the add_eessi_versions argument to only add +# specific versions (e.g. add_eessi_versions=['2025.06']), or add_eessi_versions=False to define the +# EESSI environments and partition environs yourself. set_common_required_config(site_configuration, eessi_prepare_cmds=eessi_prepare_cmds) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index 1cbeb247..d8963267 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -119,7 +119,8 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True :param set_memory: whether to set memory resources :param eessi_prepare_cmds: list of prepare commands for the environments created for `add_eessi_versions` :param add_eessi_versions: EESSI versions to add to the site configuration, each as a ReFrame environment - that is also added to every partition. + that is also added to the partitions. Environments already defined by the site are kept as they are, + and partitions that already list an EESSI environment (name starting with 'EESSI-') are left alone. True (default): all versions found by Lmod list of versions: only those versions, e.g. ['2025.06'] False: add no versions, the site defines its own EESSI environments and partition environs @@ -156,24 +157,26 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True if 'environments' not in site_configuration: site_configuration['environments'] = environments - elif environments and site_configuration['environments'] != environments: - msg = f"Appending environments {environments} to the environments already present in the site_configuration" - msg += f" ({site_configuration['environments']})" - getlogger().info(msg) - site_configuration['environments'].extend(environments) + else: + # Don't redefine environments that are already defined by the site + defined_environments = {env['name'] for env in site_configuration['environments']} + new_environments = [env for env in environments if env['name'] not in defined_environments] + if new_environments: + msg = f"Appending environments {new_environments} to the environments already present in the" + msg += f" site_configuration ({site_configuration['environments']})" + getlogger().info(msg) + site_configuration['environments'].extend(new_environments) for system in site_configuration.get('systems', []): for partition in system.get('partitions', []): - # Set or overwrite the partition environment + # Add the EESSI environments, unless the site already selected specific EESSI environments for the partition if 'environs' not in partition: partition['environs'] = environs - else: - missing_environs = [env for env in environs if env not in partition['environs']] - if missing_environs: - msg = f"Appending environs {missing_environs} to the existing environs ({partition['environs']})" - msg += f" for {system['name']}:{partition['name']}" - getlogger().info(msg) - partition['environs'].extend(missing_environs) + elif environs and not any(env.startswith('EESSI-') for env in partition['environs']): + msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" + msg += f" for {system['name']}:{partition['name']}" + getlogger().info(msg) + partition['environs'].extend(environs) # Set or overwrite the 'use_nodes_option' scheduler option, if this is a SLURM-like scheduler if partition['scheduler'] in ['slurm', 'squeue']: From 266486cea4c30618e86663ca213a2b5ea0c3b600 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 16:33:42 +0100 Subject: [PATCH 06/10] add info and warning messages --- eessi/testsuite/common_config.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index d8963267..bec747e3 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -137,6 +137,9 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True else: raise EESSIError(f'add_eessi_versions must be True, False or a list of versions, got {add_eessi_versions!r}') + if eessi_prepare_cmds and not add_eessi_versions: + getlogger().warning('Ignoring eessi_prepare_cmds: add_eessi_versions is set to add no EESSI versions.') + environments = [ {'name': f'EESSI-{version}', 'modules': [f'EESSI/{version}'], 'prepare_cmds': eessi_prepare_cmds} for version in eessi_versions @@ -161,9 +164,12 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True # Don't redefine environments that are already defined by the site defined_environments = {env['name'] for env in site_configuration['environments']} new_environments = [env for env in environments if env['name'] not in defined_environments] + kept_environments = [env['name'] for env in environments if env['name'] in defined_environments] + if kept_environments: + getlogger().info(f"Keeping site-defined environments {kept_environments}") if new_environments: - msg = f"Appending environments {new_environments} to the environments already present in the" - msg += f" site_configuration ({site_configuration['environments']})" + msg = f"Appending environments {[env['name'] for env in new_environments]} to the environments" + msg += f" already present in the site_configuration ({sorted(defined_environments)})" getlogger().info(msg) site_configuration['environments'].extend(new_environments) @@ -172,11 +178,21 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True # Add the EESSI environments, unless the site already selected specific EESSI environments for the partition if 'environs' not in partition: partition['environs'] = environs - elif environs and not any(env.startswith('EESSI-') for env in partition['environs']): - msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" - msg += f" for {system['name']}:{partition['name']}" - getlogger().info(msg) - partition['environs'].extend(environs) + if not add_eessi_versions: + msg = f"No environs set for {system['name']}:{partition['name']}:" + msg += " no tests will run on this partition." + getlogger().warning(msg) + elif environs: + existing_eessi_environs = [env for env in partition['environs'] if env.startswith('EESSI-')] + if existing_eessi_environs: + msg = f"Keeping existing EESSI environs {existing_eessi_environs}" + msg += f" for {system['name']}:{partition['name']}" + getlogger().info(msg) + else: + msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" + msg += f" for {system['name']}:{partition['name']}" + getlogger().info(msg) + partition['environs'].extend(environs) # Set or overwrite the 'use_nodes_option' scheduler option, if this is a SLURM-like scheduler if partition['scheduler'] in ['slurm', 'squeue']: From 4eed108846d6ea8275d767b54c8b7f77c011aefd Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 17:05:54 +0100 Subject: [PATCH 07/10] fixes --- config/settings_example.py | 6 ++++-- eessi/testsuite/common_config.py | 7 +++++-- eessi/testsuite/utils.py | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/settings_example.py b/config/settings_example.py index 9e65645f..b31d0ecc 100644 --- a/config/settings_example.py +++ b/config/settings_example.py @@ -116,9 +116,11 @@ ], } -# Set prepare commands for making EESSI modules available +# Set prepare commands for making EESSI modules available in the test jobs. +# Note: make sure that the EESSI modules are also available (in $MODULEPATH) before starting ReFrame: +# the prepare commands only run in the test jobs, while EESSI versions and software are detected at startup. eessi_prepare_cmds = [ - 'module unuse MODULEPATH', + 'module unuse $MODULEPATH', 'module use /cvmfs/software.eessi.io/init/modules', # If the system doesn’t have an Lmod installation by default, the following # commands will use the one from EESSI. Note that it is up to you to pick a diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index bec747e3..bad228c2 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -86,7 +86,10 @@ def get_available_eessi_versions(): """ lmod_cmd = os.getenv('LMOD_CMD') if not lmod_cmd: - raise EESSIError('Environment variable LMOD_CMD is not set: Lmod is required to query the EESSI versions.') + raise EESSIError( + 'Environment variable LMOD_CMD is not set: Lmod is required to query the EESSI versions.' + ' Use the add_eessi_versions argument of set_common_required_config to skip this query.' + ) # EESSI modules may be hidden by the site, so include hidden modules cmd = [lmod_cmd, 'python', '--show-hidden', '--terse', 'avail', 'EESSI'] @@ -177,7 +180,7 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True for partition in system.get('partitions', []): # Add the EESSI environments, unless the site already selected specific EESSI environments for the partition if 'environs' not in partition: - partition['environs'] = environs + partition['environs'] = list(environs) if not add_eessi_versions: msg = f"No environs set for {system['name']}:{partition['name']}:" msg += " no tests will run on this partition." diff --git a/eessi/testsuite/utils.py b/eessi/testsuite/utils.py index 32f18250..a86398ed 100644 --- a/eessi/testsuite/utils.py +++ b/eessi/testsuite/utils.py @@ -164,8 +164,8 @@ def _is_valid_for_env(mod, env): if environ_mapping is None: return True - for patt, env in environ_mapping.items(): - if re.match(patt, mod) and env == env: + for patt, mapped_env in environ_mapping.items(): + if re.match(patt, mod) and mapped_env == env: return True return False From 1e9e5e360ad257ef5ede15283ee3507844afe8d6 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 22:33:04 +0100 Subject: [PATCH 08/10] add NO_EESSI marker --- config/settings_example.py | 11 +++++++---- eessi/testsuite/common_config.py | 28 +++++++++++++++++++++------- eessi/testsuite/constants.py | 4 ++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/config/settings_example.py b/config/settings_example.py index b31d0ecc..a34ad27d 100644 --- a/config/settings_example.py +++ b/config/settings_example.py @@ -131,8 +131,11 @@ ] # Set common Slurm config options -# By default, all EESSI versions found by Lmod are added as environments to every partition, except -# partitions that already list an EESSI environment. Use the add_eessi_versions argument to only add -# specific versions (e.g. add_eessi_versions=['2025.06']), or add_eessi_versions=False to define the -# EESSI environments and partition environs yourself. +# By default, all EESSI versions found by Lmod are added as environments to every partition. +# To change this for all partitions, use the add_eessi_versions argument: +# - add_eessi_versions=['2025.06']: only add these versions +# - add_eessi_versions=False: add no versions, define the EESSI environments and partition environs yourself +# To change this for a single partition, set its environs: +# - 'environs': ['EESSI-2025.06']: only use these EESSI versions +# - 'environs': ['my_env', NO_EESSI]: don't add EESSI environments (NO_EESSI is in eessi.testsuite.constants) set_common_required_config(site_configuration, eessi_prepare_cmds=eessi_prepare_cmds) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index bad228c2..cc91cffd 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -6,7 +6,7 @@ from reframe.core.exceptions import ConfigError from reframe.core.logging import getlogger -from eessi.testsuite.constants import FEATURES +from eessi.testsuite.constants import FEATURES, NO_EESSI from eessi.testsuite.utils import EESSIError @@ -122,8 +122,10 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True :param set_memory: whether to set memory resources :param eessi_prepare_cmds: list of prepare commands for the environments created for `add_eessi_versions` :param add_eessi_versions: EESSI versions to add to the site configuration, each as a ReFrame environment - that is also added to the partitions. Environments already defined by the site are kept as they are, - and partitions that already list an EESSI environment (name starting with 'EESSI-') are left alone. + that is also added to the partitions. Environments already defined by the site are kept as they are. + A partition that lists no EESSI environment gets all added versions; a partition that lists one or more + (name starting with 'EESSI-') is left alone, so it runs exactly those. To add no EESSI environments to a + partition, add the marker `NO_EESSI` (from eessi.testsuite.constants) to its 'environs'. True (default): all versions found by Lmod list of versions: only those versions, e.g. ['2025.06'] False: add no versions, the site defines its own EESSI environments and partition environs @@ -169,7 +171,7 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True new_environments = [env for env in environments if env['name'] not in defined_environments] kept_environments = [env['name'] for env in environments if env['name'] in defined_environments] if kept_environments: - getlogger().info(f"Keeping site-defined environments {kept_environments}") + getlogger().info(f"Using site-defined environments {kept_environments}") if new_environments: msg = f"Appending environments {[env['name'] for env in new_environments]} to the environments" msg += f" already present in the site_configuration ({sorted(defined_environments)})" @@ -179,7 +181,19 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True for system in site_configuration.get('systems', []): for partition in system.get('partitions', []): # Add the EESSI environments, unless the site already selected specific EESSI environments for the partition - if 'environs' not in partition: + # or opted out with the NO_EESSI marker. The marker is not a real environment, so it must always be removed. + if NO_EESSI in partition.get('environs', []): + partition['environs'] = [env for env in partition['environs'] if env != NO_EESSI] + if any(env.startswith('EESSI-') for env in partition['environs']): + msg = f"{system['name']}:{partition['name']} lists both {NO_EESSI} and EESSI environments:" + msg += f" {partition['environs']}" + raise EESSIError(msg) + getlogger().info(f"Not adding EESSI environs to {system['name']}:{partition['name']}") + if not partition['environs']: + msg = f"No environs set for {system['name']}:{partition['name']}:" + msg += " no tests will run on this partition." + getlogger().warning(msg) + elif 'environs' not in partition: partition['environs'] = list(environs) if not add_eessi_versions: msg = f"No environs set for {system['name']}:{partition['name']}:" @@ -188,8 +202,8 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True elif environs: existing_eessi_environs = [env for env in partition['environs'] if env.startswith('EESSI-')] if existing_eessi_environs: - msg = f"Keeping existing EESSI environs {existing_eessi_environs}" - msg += f" for {system['name']}:{partition['name']}" + msg = f"Not adding more EESSI environs to {system['name']}:{partition['name']}:" + msg += f" it already lists {existing_eessi_environs}" getlogger().info(msg) else: msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" diff --git a/eessi/testsuite/constants.py b/eessi/testsuite/constants.py index c198e493..625938af 100644 --- a/eessi/testsuite/constants.py +++ b/eessi/testsuite/constants.py @@ -53,6 +53,10 @@ class _GPUVendors(NamedTuple): FEATURES = _Features() GPU_VENDORS = _GPUVendors() +# Marker for the 'environs' of a partition in the site configuration: don't add EESSI environments to this partition. +# It is removed from 'environs' by set_common_required_config, so it is not a real ReFrame environment. +NO_EESSI = 'NO_EESSI' + SCALES = { # required keys: # - num_nodes From a7177ba1d83af5a241ed671c9c306fdddb6f5006 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sun, 8 Nov 2026 22:52:17 +0100 Subject: [PATCH 09/10] fix --- eessi/testsuite/common_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index cc91cffd..57951297 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -209,7 +209,7 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True msg = f"Appending environs {environs} to the existing environs ({partition['environs']})" msg += f" for {system['name']}:{partition['name']}" getlogger().info(msg) - partition['environs'].extend(environs) + partition['environs'] = partition['environs'] + environs # Set or overwrite the 'use_nodes_option' scheduler option, if this is a SLURM-like scheduler if partition['scheduler'] in ['slurm', 'squeue']: From 7bd05a3b9362c2c63a1d4465c28f9d5bf4f8169d Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Mon, 9 Nov 2026 16:31:11 +0100 Subject: [PATCH 10/10] use reframe machinery for lmod; convert error to warning for missing lmod; update info msg --- eessi/testsuite/common_config.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/eessi/testsuite/common_config.py b/eessi/testsuite/common_config.py index 57951297..81481bfd 100644 --- a/eessi/testsuite/common_config.py +++ b/eessi/testsuite/common_config.py @@ -1,10 +1,10 @@ import json import os -import subprocess from reframe.core.config import load_config -from reframe.core.exceptions import ConfigError +from reframe.core.exceptions import ConfigError, EnvironError from reframe.core.logging import getlogger +from reframe.core.modules import ModulesSystem from eessi.testsuite.constants import FEATURES, NO_EESSI from eessi.testsuite.utils import EESSIError @@ -84,25 +84,19 @@ def get_available_eessi_versions(): The EESSI modules must already be available (in $MODULEPATH) before running ReFrame. :return: sorted list of available EESSI versions, e.g. ['2023.06', '2025.06'] """ - lmod_cmd = os.getenv('LMOD_CMD') - if not lmod_cmd: - raise EESSIError( - 'Environment variable LMOD_CMD is not set: Lmod is required to query the EESSI versions.' - ' Use the add_eessi_versions argument of set_common_required_config to skip this query.' - ) - - # EESSI modules may be hidden by the site, so include hidden modules - cmd = [lmod_cmd, 'python', '--show-hidden', '--terse', 'avail', 'EESSI'] + # EESSI modules are Lua modulefiles, so they can only be found and used with Lmod try: - # Lmod prints the output of 'module avail' to stderr - result = subprocess.run(cmd, capture_output=True, text=True, check=True) - except (OSError, subprocess.CalledProcessError) as err: - raise EESSIError(f'Failed to query the available EESSI versions with {cmd}: {err}') from err + lmod = ModulesSystem.create('lmod') + # EESSI modules may be hidden by the site, so include hidden modules + output = lmod.execute('--show-hidden', '--terse', 'avail', 'EESSI') + except (ConfigError, EnvironError) as err: + getlogger().warning(f'Not adding EESSI environments: Lmod is required to use EESSI, but failed with: {err}') + return [] # lines look like 'EESSI/2025.06' or 'EESSI/2025.06 ' versions = { line.split()[0].split('/', 1)[1] - for line in result.stderr.splitlines() + for line in output.splitlines() if line.startswith('EESSI/') } if not versions: @@ -188,7 +182,9 @@ def set_common_required_config(site_configuration: dict, set_memory: bool = True msg = f"{system['name']}:{partition['name']} lists both {NO_EESSI} and EESSI environments:" msg += f" {partition['environs']}" raise EESSIError(msg) - getlogger().info(f"Not adding EESSI environs to {system['name']}:{partition['name']}") + msg = f"Not adding EESSI environs to {system['name']}:{partition['name']}:" + msg += f" it has the {NO_EESSI} marker in its environs" + getlogger().info(msg) if not partition['environs']: msg = f"No environs set for {system['name']}:{partition['name']}:" msg += " no tests will run on this partition."