jupyterhub / jupyterhub/batchspawner

module envs are missing when using SlurmSpawner

Open
#246 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
207
Forks
136
PR merge metrics
No merged PRs in 30d

Description

### Bug description

My sbatch script is:
```
[I 2022-06-02 22:44:23.718 JupyterHub batchspawner:292] Spawner submitted script:
#!/bin/bash
#SBATCH -t 00:30:00
#SBATCH -N 1
env
module load PrgEnv/GCC+OpenMPI/2021-05-27 cuda gcc openmpi
which mpirun
batchspawner-singleuser jupyterhub-singleuser
```
I am getting an error in the slurm-xxxxx.out
`/var/spool/slurm/d/job242029/slurm_script: line 5: module: command not found`
Looks like it can not find the module.

However, if I manually submit the script using `sbatch mytest.sub`, and I do not see the error.

#### More details

I compared the `env` output from the slurm.out generated by SlurmSpawner and the one generated by manual submission, and I found out the following module related envs are missing from the slurm.out generated by the spawner.
```
MODULEPATH=/gpfs/fs1/SHARE/Modules/Latest:/gpfs/sw/modules/all:/gpfs/fs1/SHARE/Modules/Bundles:/gpfs/fs1/SHARE/Modules/PrgEnv/GCC+OpenMPI/2021-05-27
MODULEPATH_ROOT=/gpfs/fs1/SHARE/Utils/Lmod/8.1/GCC-BASE-7.4.0/modulefiles
MODULESHOME=/gpfs/fs1/SHARE/Utils/Lmod/8.1/GCC-BASE-7.4.0
BASH_FUNC_module%%=() { eval $($LMOD_CMD bash "$@") && eval $(${LMOD_SETTARG_CMD:-:} -s sh)
}
BASH_FUNC_ml%%=() { eval $($LMOD_DIR/ml_cmd "$@")
}
```
Is it a bug or did I miss anything when using the SlurmSpawner?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.