Hi Andreas,

The Slurm controller has job names in its own data structure.

The Slurm controller job name is set to the name of the job script by
default, or to a name you define for example with -J.
The environment variable SLURM_JOB_NAME is then set to this Slurm
controller job name by job start.

So there are two job names you can change for a running job, depending on
what you want to do more exactly:

scontrol update job=$SLURM_JOB_ID name=myname
- Updates the Slurm controller job name, in the Slurm controller's data
structure.
- Controller calls like squeue will use this new name. For example squeue
-n myname will list all jobs with this name.
- Doesn't update SLURM_JOB_NAME. So the name that is presented by slurmctld
can be changed back and forth without messing up the environment variable.

export SLURM_JOB_NAME=myname
- Updates the environment variable SLURM_JOB_NAME, just like you did.
- The current job's process will get this new environment variable. You can
refer to this new name (in code/child processes after the change) using
$SLURM_JOB_NAME.
- Doesn't update the Slurm controller job name.

Best regards,
Jessica Nettelblad, UPPMAX

On Thu, Mar 22, 2018 at 10:16 PM, Andreas Hilboll <
hilboll+sl...@uni-bremen.de> wrote:

> Hi,
>
> I'd like to be able to set the SLURM_JOB_NAME from within the script I'm
> submitting to `sbatch`.  So, e.g., with the script `myscript.sh`,
>
>    #!/bin/bash
>    export SLURM_JOB_NAME='myname'
>    sleep 120
>
> and then `sbatch myscript.sh`, I'd like the job's name to be 'myname'.
>
> Is this somehow possible?  When I tried the above approach, it didn't work
> (squeue reported the job's name to be 'myscript.sh').
>
> Thanks for your help,
>  Andreas
>
>

Reply via email to