I have a python submission script that I run with sbatch
using slurm
:
sbatch batch.py
when I do this things do not work properly because I assume, the batch.py
process does not inherit the right environment variables. Thus instead of running batch.py
from where the sbatch
command was done, its ran from somewhere else (/
I believe). I have managed to fix this by doing wrapping the python script with a bash script:
#!/usr/bin/env bash
cd path/to/scripts
python script.py
this temporary hack sort of works it seems though it seems that it avoids the question all together rather than addressing it. Does someone know how to fix this in a better way?
I know for example, that in docker the -w
or -WORKDIR
exists so that the docker container knows where its suppose to be at. I was wondering if something like that existed for slurm.
--workdir=<directory> Set the working directory of the batch script to directory before it is executed. The path can be specified as full path or relative path to the directory where the command is executed.
– Neel--get-user-env
a look, you mean take a look at the flag or is it a environment variable? – Neel