TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
489 stars 128 forks source link

Add ability to set downstream defaults when a module is loaded #679

Closed jcsiadal closed 1 month ago

jcsiadal commented 10 months ago

SUMMARY

Provide a mechanism to set defaults for other modules at the time a new module is loaded. Instead of module defaults being purely static, allow for dynamic configuration of defaults. While Lmod supports a hierarchical environment tree, there is no way for modules to control loading the correct version of downstream modules, since Lmod will simply default to the latest or locally defined default, even if the downstream version of something is not validated (or doesn't work) against the upstream version.

Example

Let's say we have the following module hierarchy. A,B,C,D are directories of modules for apps and libraries and C and D are on read-only remote shares (no admin control). When A is loaded, it adds B to the module path, B adds C, etc. All versions of each lib or app module are in the same directory (typical setup).

A -> B -> | C -> D

When a specific version of module A is loaded, there is no way for a matching, validated, version of C and D to be loaded automatically, other than modifying each module in the chain. I don't see a way for a user to get a fully validated toolchain automatically, other than to load the entire chain in a single module file.

If a user loads an older version of library A, then there should be a way for Lmod to load the correct older module versions of B, C, and D, but only when/if the user loads them.

Desired behavior

The ideal fix is for the "module_version()" function to work directly in regular modules. It should override all other behavior for defaults.

Another option is to make $LMOD_MODULERC dynamic, so it can point to a different file with downstream defaults defined.

As a side note, the "conflict()" function needs to operate downstream and support versioning. That is, a module should not load if a conflict for that module or module/version has been set by a previous module.

rtmclay commented 10 months ago

Thanks for submitting this. Your desired behavior is to use "module_version()". It is not clear to me what you want to happen. Currently, the "module_version()" function returns the current version of the module being loaded. Please explain how this would work and please use concrete examples. Also, it is unclear what you mean by how conflict() would now work. Thanks!

rtmclay commented 6 months ago

Support for downstream conflicts added. To use configure Lmod with --downstreamConflicts=yes in the PR679 branch

Note that there is no new conflict() function. With the configure option conflicts() are support both current conflicts and downstream conflicts.

There is no support for downstream defaults yet.

rtmclay commented 4 months ago

The PR679 branch of Lmod now has support for dynamic LMOD_MODULERC. Note that each time the system or a modulefile sets LMOD_MODULERC all the old defaults are gone. But you can either append or prepend to LMOD_MODULERC for Lmod to use all the old files as LMOD_MODULERC is a colon separated list of files or directories to build the defaults for.

rtmclay commented 3 months ago

O.K. to close this issue?

rtmclay commented 1 month ago

This branch has been merged onto the main branch and has been released at Lmod 8.7.48 Closing this issue. Feel free to reopen if new problems arise.