Loading /etc/profile.d/moduleslist.sh to run the "module use" command before the user runs jobs with job composer

Hello everybody,

We configured ondemand v3.0 in rockylinux 8.

We have our HPC with SLURM and we run when users log in script /etc/profile.d/moduleslist.sh, where we check user membership to certain groups, and depending on those groups are loaded some module directories or others by “module use”.
When we try to run in the job composer in ondemand, we do not see the available modules. How can we make the previous script run or alternative way so that when the job script is launched in job composer we do not have error of not finding the software module we want?

We have been looking for a way to do this, but we don’t see clear a way to configure script location in ondemand configuration to run this before users use job composer and launch their scripts.

Thanks in advance.

I am trying to understand what you are doing. You want a script to run each time any user submits a job that checks the group permissions and then loads modules based off the group they are in?

Sorry Travert, maybe I didn’t explain it properly.

When our users access the login nodes via SSH, we check the user’s membership to certain groups, depending on the group we make them able to see a list of available software or another, there is some software that we only make available to a certain group of users.

This is done through a script in /etc/profile.d/ that contains commands “module use moduledirectory”.

How can we do this in ondemand?, is it possible to run such a similar script to show one list of available software or another to users?,or, do we have to set environment variables statically somewhere in the ondemand configuration? These are some of the doubts we have, we have been searching and it is not quite clear.


I think you can do this by just running that script from the Job Composer but ensure you include it in the script the user runs. So, when that script is submitted part of what it will do is typically do a module purge followed by some module load of whatever you may need. It will be that module load in the script you need to play with for the users to get those all populated correctly.

How you get each user to include that line I’m not sure of. @jeff.ohrstrom do we do anything like this at OSC for users to load modules in the Job Composer based on user groups?

I want to suggest a Slurm prolog. The question I would have is - how does this work from the CLI? I mean how are modules (and the module system) made available to you when you submit through the command line?

I’m finding on our systems there’s different behavior with --export=NONE (OnDemand’s default) and --export=ALL (Slurm’s default).

IDK if we have some filter or prologe that loads things up, so I’m working to confirm this. However, I’d still suggest a prolog to set the environment up so that it’s across all jobs, but that’s why I ask what the CLI behavior is and how folks’ get access to these modules when they issue sbatch from the command line.


Sorry for the delay in my reply.

CLI users when they log in already have a list of modules available and can load software as needed. This is done by scripting in /etc/profile.d/ .
According to what you indicate, is there any way in ONDEMAND to change behaviour from default --export=NONE to --export=ALL (Slurm default)?


In the job composer there’s a check box in the form to copy environment. This will use --export=ALL.


We have tried it without success, so we will try to leave it done with prolog. Thank you everyone for the help!