[slurm-users] How to access environment variables in submit script?
Paul Edmon
pedmon at cfa.harvard.edu
Thu May 10 08:09:22 MDT 2018
Not that I am aware of. Since the header isn't really part of the
script bash doesn't evaluate them as far as I know.
-Paul Edmon-
On 05/10/2018 09:19 AM, Dmitri Chebotarov wrote:
> Hello
>
> Is it possible to access environment variables in a submit script?
> F.e. $SCRATCH is set to a path and I like to use $SCRATCH variable in #SBATCH:
>
> #SBATCH --output=$SCRATCH/slurm/%j.out
> #SBATCH --error=$SCRATCH/slurm/%j.err
>
> Since it's Bash script, # are ignored and I suspect these variables need to be defined on Slurm controller (?).
>
> As a workaround I can run 'sbatch --output=$SCRATCH/slurm/%j.out --error=$SCRATCH/slurm/%j.err <myscript>' and it works. But is there any way to use non-slurm env variables via #SBATCH?
>
> Thank you
>
More information about the slurm-users
mailing list