Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks should be defined in SitePackage.lua, not in lmodrc.lua #491

Closed
casparvl opened this issue Mar 6, 2024 · 2 comments · Fixed by #496
Closed

Hooks should be defined in SitePackage.lua, not in lmodrc.lua #491

casparvl opened this issue Mar 6, 2024 · 2 comments · Fixed by #496

Comments

@casparvl
Copy link
Collaborator

casparvl commented Mar 6, 2024

Defining hooks in lmodrc.lua works if the lmodrc.lua files are read early enough in the process of a module load. However, #490 (comment) shows that this is only the case under certain circumstances, and by no way a guarantee. We should probably move registration of the hooks to SitePackage.lua, as this is the officially document location for hooks https://lmod.readthedocs.io/en/latest/170_hooks.html?highlight=hook#hook-functions

@ocaisa
Copy link
Member

ocaisa commented Mar 6, 2024

The positive thing is we should still be able to do that in a way that allows sites to customise the hooks.

We can point to our SitePackage.lua by setting LMOD_PACKAGE_PATH=/path/to/the/Site/Directory, and this can leverage hooks from the equivalent location under host_injections. @casparvl noted that changing LMOD_PACKAGE_PATH does not seem to require reconfiguring Lmod, so we can still have dynamic behaviour.

@casparvl
Copy link
Collaborator Author

casparvl commented Mar 6, 2024

In fact, it's mostly a renaming exercise: our create_lmodrc.py (for now), only writes hooks. I.e. what it creates is actually a SitePackage.lua, even though we save it as lmodrc.lua :). If we just name it that, park it in $EESSI_SOFTWARE_PATH/.lmod (where we now also put the lmodrc.lua and set

export LMOD_PACKAGE_PATH="$EESSI_SOFTWARE_PATH/.lmod"

we're done (I think). We do need to probably make sure that LMOD_CONFIG_DIR does not get set, and/or that the existing lmodrc.lua files get removed from the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants