cmd-ntrf / jupyter-lmod

Jupyter plugin that provides a tab for TACC Lmod (https://github.com/TACC/Lmod)
MIT License
28 stars 13 forks source link

Reset lmod during extension start #55

Closed ktaletsk closed 9 months ago

ktaletsk commented 1 year ago

In our project using jupyter-lmod is combined with a system where users can select the environment modules they want prior to the launch of the server in JupyterHub. The user choices is then translated to environment variable LMOD_SYSTEM_DEFAULT_MODULES in the user server. However, we noticed that even though lmod CLI would respect that choice, the jupyter-lmod would not.

We found that resetting the extension backend by calling _lmod.reset() resolved our issue. Therefore, we offer to add this change in the upstream

cmd-ntrf commented 1 year ago

Thanks for the suggestion!

Lmod documentation recommends running module --initial_load --no_redirect restore after setting LMOD_SYSTEM_DEFAULT_MODULES. https://lmod.readthedocs.io/en/latest/070_standard_modules.html

The module restore tries to restore the user’s default collection. If that doesn’t exist, it then uses contents of the variable LMOD_SYSTEM_DEFAULT_MODULES to find a colon separated list of Modules to load.

Is it possible in your environment to first run module restore before launching the jupyter-single-server? Is it the case already?

You mentionned that lmod CLI respects that choice, is the CLI access with Jupyter terminal?

cmd-ntrf commented 1 year ago

@ktaletsk: can you also tell me which spawner you are using?

ktaletsk commented 1 month ago

Reporting back after more than a year (😱) delay!

module --initial_load --no_redirect restore worked perfectly in the latest version, no code modifications needed. I just added it to start-singleuser.sh script right before loading JupyterLab. I tested in Dockerspawner.