Skip to content

Commit 06461ea

Browse files
committed
Introduce --module-cache-suffix to allow multiple caches
This is useful when having multiple module trees (i.e. different `--installprefix`) to not overwrite the cache file of one with the other when using `--update-modules-tool-cache`. Inspired by how LMod itself creates the cache, e.g. `~/.cache/lmod/spiderT.rapids_x86_64_Linux.lua`
1 parent 850b7fd commit 06461ea

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

easybuild/tools/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
239239
'job_polling_interval',
240240
'job_target_resource',
241241
'locks_dir',
242+
'module_cache_suffix',
242243
'modules_footer',
243244
'modules_header',
244245
'mpi_cmd_template',

easybuild/tools/modules.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ def update(self):
14361436
# don't actually update local cache when testing, just return the cache contents
14371437
return stdout
14381438
else:
1439-
cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT.lua')
1439+
suffix = build_option('module_cache_suffix') or ''
1440+
cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT%s.lua' % suffix)
14401441
self.log.debug("Updating Lmod spider cache %s with output from '%s'" % (cache_fp, ' '.join(cmd)))
14411442
cache_dir = os.path.dirname(cache_fp)
14421443
if not os.path.exists(cache_dir):

easybuild/tools/options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ def override_options(self):
461461
"environment variable and its value separated by a colon (':')",
462462
None, 'store', DEFAULT_MINIMAL_BUILD_ENV),
463463
'minimal-toolchains': ("Use minimal toolchain when resolving dependencies", None, 'store_true', False),
464+
'module-cache-suffix': ("Suffix to add to the cache file name (before the extension) "
465+
"when updating the modules tool cache",
466+
None, 'store', None),
464467
'module-only': ("Only generate module file(s); skip all steps except for %s" % ', '.join(MODULE_ONLY_STEPS),
465468
None, 'store_true', False),
466469
'modules-tool-version-check': ("Check version of modules tool being used", None, 'store_true', True),

0 commit comments

Comments
 (0)