<div dir="ltr"><div><div><div><div>Hi Andreas, <br><br></div><div>The Slurm controller has job names in its own data structure. <br><br>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. <br>The <span class="gmail-gr_ gmail-gr_40 gmail-gr-alert gmail-gr_spell gmail-gr_inline_cards gmail-gr_run_anim gmail-ContextualSpelling gmail-ins-del gmail-multiReplace" id="gmail-40"><span class="gmail-gr_ gmail-gr_153 gmail-gr-alert gmail-gr_spell gmail-gr_inline_cards gmail-gr_run_anim gmail-ContextualSpelling gmail-ins-del gmail-multiReplace" id="gmail-153">environment</span></span> variable SLURM_JOB_NAME is then set to this Slurm controller job name by job start. <br><br>So there are two job names you can change for a running job, depending on what you want to do more exactly:<br><br></div></div>scontrol update job=$SLURM_JOB_ID name=myname<br></div>- Updates the Slurm controller job name, in the Slurm controller's data structure. <br>- Controller calls like squeue will use this new name. For example squeue -n myname will list all jobs with this name.<br></div><div>- 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. <br></div><div><br>
<div>export SLURM_JOB_NAME=myname <br>- Updates the environment variable SLURM_JOB_NAME, just like you did. <br>- 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.<br>- Doesn't update the Slurm controller job name.<br></div></div><div><br>Best regards, <br></div><div>Jessica Nettelblad, UPPMAX<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 22, 2018 at 10:16 PM, Andreas Hilboll <span dir="ltr"><<a href="mailto:hilboll+slurm@uni-bremen.de" target="_blank">hilboll+slurm@uni-bremen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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`,<br>
<br>
#!/bin/bash<br>
export SLURM_JOB_NAME='myname'<br>
sleep 120<br>
<br>
and then `sbatch myscript.sh`, I'd like the job's name to be 'myname'.<br>
<br>
Is this somehow possible? When I tried the above approach, it didn't work (squeue reported the job's name to be 'myscript.sh').<br>
<br>
Thanks for your help,<br>
Andreas<br>
<br>
</blockquote></div><br></div>