Search code examples
slurmsbatch

Use slurm JobID as input?


Is it possible to use the JobID as an input of the script you are submiting?

I know you can use %j to name the log file with the JobID, but is it possible to do, for example, something similar to

sbatch make-dir.sh %j

where make-dir.sh is

#!/bin/bash

echo $1

As it stands now, it will print %j, but I would like it to print the JobID.

Thanks.


Solution

  • You should use the environment variable $SLURM_JOBID in the make-dir.sh

    #!/bin/bash
    
    echo $SLURM_JOBID