Add ignore_cache_subcmds configuration option - #688
Merged
Conversation
Module cache file aggregates the content of all the modulercs and modulefiles found in a modulepath. When a module search occurs, this whole file is evaluated even if the search targets specific modules. On setups with a very large number of modulefiles, resulting in cache files of several megabytes, evaluating the whole cache file may take longer than walking through the modulepath directory to find the few requested modules. Add the ignore_cache_subcmds configuration option that defines a list of module sub-commands on which module cache files are ignored. When one of these sub-commands is run, modulepath directories are walked through to search modules instead of relying on their cache file. Option is compared against the resolved top-level sub-command name, obtained with the new topCommandName helper procedure, so sub-command name aliases (like add for load) resolve to their target sub-command and cache is also ignored for the searches that the evaluated modulefiles trigger. The ml command used without a sub-command name translates to the underlying load or unload sub-command it is currently processing. When configuration is modified it sets the MODULES_IGNORE_CACHE_SUBCMDS environment variable. Fixes envmodules#563 Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Add ignore_cache_subcmds to the configuration option names proposed by the bash, fish, tcsh and zsh completion scripts for the config sub-command. Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Describe the ignore_cache_subcmds configuration option and its associated MODULES_IGNORE_CACHE_SUBCMDS environment variable in the module man page, configuration option table, release notes, migration guide and module cache design notes. Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Clear MODULES_IGNORE_CACHE_SUBCMDS from test environment, add the new option to the config sub-command checks and craft specific tests verifying cache files are only ignored on the sub-commands listed in option value. Sub-command name alias resolution (add) and ml frontend translation to underlying load sub-command are also covered. These tests fail without the ignore_cache_subcmds option code change. Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A module cache file aggregates the content of all the modulercs and modulefiles found in a modulepath. When a module search occurs, this whole file is evaluated even if the search targets specific modules. On setups with a very large number of modulefiles, resulting in cache files of several megabytes, evaluating the whole cache file may take longer than walking through the modulepath directory to find the few requested modules, as reported in the mailing-list discussion linked in #563.
This change introduces the
ignore_cache_subcmdsconfiguration option that defines a list of module sub-commands on which module cache files are ignored. When one of these sub-commands is run, modulepath directories are walked through to search modules instead of relying on their cache file. For instance to keep cache benefit on listing sub-commands but avoid its penalty on targeted ones:The option is compared against the resolved top-level sub-command name, obtained with the new
topCommandNamehelper procedure: sub-command name aliases (likeaddforload) resolve to their target sub-command, and themlcommand used without a sub-command name translates to the underlyingloadorunloadsub-command it is currently processing. When the configuration option is changed with theconfigsub-command, it sets theMODULES_IGNORE_CACHE_SUBCMDSenvironment variable.Fixes #563