Skip to content

Commit

Permalink
Introduce --module-cache-suffix to allow multiple caches
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
Flamefire committed Dec 14, 2023
1 parent 850b7fd commit 06461ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions easybuild/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
'job_polling_interval',
'job_target_resource',
'locks_dir',
'module_cache_suffix',
'modules_footer',
'modules_header',
'mpi_cmd_template',
Expand Down
3 changes: 2 additions & 1 deletion easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,8 @@ def update(self):
# don't actually update local cache when testing, just return the cache contents
return stdout
else:
cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT.lua')
suffix = build_option('module_cache_suffix') or ''
cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT%s.lua' % suffix)
self.log.debug("Updating Lmod spider cache %s with output from '%s'" % (cache_fp, ' '.join(cmd)))
cache_dir = os.path.dirname(cache_fp)
if not os.path.exists(cache_dir):
Expand Down
3 changes: 3 additions & 0 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ def override_options(self):
"environment variable and its value separated by a colon (':')",
None, 'store', DEFAULT_MINIMAL_BUILD_ENV),
'minimal-toolchains': ("Use minimal toolchain when resolving dependencies", None, 'store_true', False),
'module-cache-suffix': ("Suffix to add to the cache file name (before the extension) "
"when updating the modules tool cache",
None, 'store', None),
'module-only': ("Only generate module file(s); skip all steps except for %s" % ', '.join(MODULE_ONLY_STEPS),
None, 'store_true', False),
'modules-tool-version-check': ("Check version of modules tool being used", None, 'store_true', True),
Expand Down

0 comments on commit 06461ea

Please sign in to comment.