[slurm-users] Slurm prolog export variable

Juergen Salk juergen.salk at uni-ulm.de
Tue Mar 23 07:39:00 UTC 2021

Hi Mike,

for pushing environvent variables into the job environment, you'll have to 
use the TaskProlog script (not the regular Prolog script). 

The location of the TaskProlog script needs to be defined in
slurm.conf, e.g. 


and the standard output of TaskProlog can be used to export 
custom environvent variables, e.g.

echo "export SCRATCH=/scratch/$SLURM_JOB_USER/$SLURM_JOB_ID"

There is some more information on TaskProlog in the slurm.conf 
man page and also here: https://slurm.schedmd.com/prolog_epilog.html

Best regards

Jürgen Salk
Scientific Software & Compute Services (SSCS)
Kommunikations- und Informationszentrum (kiz)
Universität Ulm
Telefon: +49 (0)731 50-22478
Telefax: +49 (0)731 50-22471

* Yap, Mike <M.Yap at massey.ac.nz> [210323 02:12]:
> Hi All
> Can anyone assist the following
> We're using Bright Cluster 9.1 with CentOS 7.9 running with slurm 2.02.6
> We have a script running on prolog exporting the SCRATCH as variable for user running job
> Addition command on the script to create a user folder accordingly
> When submitting the job, the folder is created without any error on the compute node (which indicate the prolog is being executed without an issue) but $SCRATCH seems to be undone once the prolog script is done
> We also tried to create an additional script to only export SCRATCH but no luck
> We have been using the same script for an older setup and it work fine. Any suggestion if there is any workaround to define $SCRACTH beside getting user to define it in their submit script ?
> Prolog script
> #!/bin/sh
> mkdir --parents $SCRATCH
> Thanks
> Mike

More information about the slurm-users mailing list