Skip to content

Commit e7f35e5

Browse files
authored
Merge pull request EESSI#43 from bedroge/modulefile_family
Allow end users to add a family name to the EESSI module
2 parents 1b0b8f9 + a8d2b11 commit e7f35e5

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.github/workflows/tests_eessi_module.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ jobs:
258258
# Initialise Lmod
259259
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
260260
261-
# Make sure we using the module file from the repository
261+
# Make sure we are using the module file from the repository
262262
export MODULEPATH=init/modules
263263
264264
# Set the relevant environment variable and load the EESSI module
@@ -269,3 +269,46 @@ jobs:
269269
# Purge and check the module is still loaded
270270
module purge
271271
module list |& grep "EESSI/${{matrix.EESSI_VERSION}}"
272+
273+
check_family_eessi_module:
274+
runs-on: ubuntu-24.04
275+
strategy:
276+
fail-fast: false
277+
matrix:
278+
EESSI_VERSION:
279+
- '2023.06'
280+
- '2025.06'
281+
282+
steps:
283+
- name: Check out software-layer repository
284+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
285+
286+
- name: Mount EESSI CernVM-FS repository
287+
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
288+
with:
289+
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
290+
cvmfs_http_proxy: DIRECT
291+
cvmfs_repositories: software.eessi.io
292+
293+
- name: Make sure we can use the family directive in the EESSI module
294+
run: |
295+
# Initialise Lmod
296+
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
297+
298+
# Add a test modulefile for a dummy stack with a "software_stack" family directive
299+
FAMILY=software_stack
300+
TMP_MODULEFILES=$(mktemp -d)
301+
LOCAL_STACK_NAME="local_stack"
302+
LOCAL_STACK_VERSION="${{matrix.EESSI_VERSION}}"
303+
mkdir -p "${TMP_MODULEFILES}/${LOCAL_STACK_NAME}"
304+
echo "family(\"${FAMILY}\")" > "${TMP_MODULEFILES}/${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}.lua"
305+
306+
# Make sure we are using the EESSI module file from the repository and the temporary one for the dummy local stack
307+
export MODULEPATH=init/modules:${TMP_MODULEFILES}
308+
309+
# Set the relevant environment variable, load the EESSI module and the local stack module, and grep for
310+
# Lmod is automatically replacing "..." with "...".
311+
export EESSI_MODULE_FAMILY_NAME=${FAMILY}
312+
module load "EESSI/${{matrix.EESSI_VERSION}}"
313+
GREP_PATTERN="Lmod is automatically replacing \"EESSI/${{matrix.EESSI_VERSION}}\" with \"${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}\"."
314+
module load "${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}" |& grep "${GREP_PATTERN}"

init/modules/EESSI/2023.06.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ if isDir(eessi_module_path_accel) then
173173
eessiDebug("Using site accelerator modules at: " .. eessi_module_path_site_accel)
174174
end
175175

176+
-- allow sites to add a family directive to the EESSI module,
177+
-- e.g. for preventing that users load two different/incompatible stacks at the same time
178+
family_name = os.getenv("EESSI_MODULE_FAMILY_NAME")
179+
if family_name then
180+
family(family_name)
181+
end
182+
176183
-- allow sites to make the EESSI module sticky by defining EESSI_MODULE_STICKY (to any value)
177184
load_message = "Module for EESSI/" .. eessi_version .. " loaded successfully"
178185
if os.getenv("EESSI_MODULE_STICKY") then

0 commit comments

Comments
 (0)