diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index 4cb660c458f81e5a8c8843335d697c4f32af8e6a..135973185cc5c0abbef5255a24995f13374af6cd 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -3726,16 +3726,36 @@ to all of the programs. .TP \fBBASIL_RESERVATION_ID\fR Basil reservation ID. -Available on Cray XT/XE systems only. +Available on Cray systems with ALPS only. .TP \fBMPIRUN_PARTITION\fR BlueGene partition name. Available on BlueGene systems only. .TP +\fBSLURM_ARRAY_JOB_ID\fR +If this job is part of a job array, this will be set to the job ID. +Otherwise it will not be set. +To reference this specific task of a job array, combine +SLURM_ARRAY_JOB_ID with SLURM_ARRAY_TASK_ID +(e.g. "scontrol update ${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ..."); +Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. +.TP +\fBSLURM_ARRAY_TASK_ID\fR +If this job is part of a job array, this will be set to the task ID. +Otherwise it will not be set. +To reference this specific task of a job array, combine +SLURM_ARRAY_JOB_ID with SLURM_ARRAY_TASK_ID +(e.g. "scontrol update ${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ..."); +Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. +.TP \fBSLURM_JOB_ACCOUNT\fR Account name used for the job. Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. .TP +\fBSLURM_JOB_CLUSTER_NAME\fR +Name of the cluster executing for the job. +Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. +.TP \fBSLURM_JOB_CONSTRAINTS\fR Features required to run the job. Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. @@ -3756,7 +3776,6 @@ exit() function. The second number of the signal that caused the process to terminante if it was terminated by a signal. Available in \fBEpilogSlurmctld\fR only. .TP - \fBSLURM_JOB_GID\fR Group ID of the job's owner. Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. @@ -3767,6 +3786,9 @@ Available in \fBPrologSlurmctld\fR and \fBEpilogSlurmctld\fR only. .TP \fBSLURM_JOB_ID\fR Job ID. +CAUTION: If this job is the first task of a job array, then Slurm commands using +this job ID will refer to the entire job array rather than this specific task +of the job array. .TP \fBSLURM_JOB_NAME\fR Name of the job. diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c index f4d2224a5c6535b57d367f3009b05317aeaf3c56..4e279078ed08ebcb6fa6c68dc0eb10a0b22c624b 100644 --- a/src/slurmctld/job_scheduler.c +++ b/src/slurmctld/job_scheduler.c @@ -2510,11 +2510,9 @@ static char **_build_env(struct job_record *job_ptr) sprintf(buf, "%d:%d", exit_code, signal); setenvf(&my_env, "SLURM_JOB_EXIT_CODE2", "%s", buf); - if (job_ptr->array_job_id != 0) { + if (job_ptr->array_task_id != NO_VAL) { setenvf(&my_env, "SLURM_ARRAY_JOB_ID", "%u", job_ptr->array_job_id); - } - if (job_ptr->array_task_id != NO_VAL) { setenvf(&my_env, "SLURM_ARRAY_TASK_ID", "%u", job_ptr->array_task_id); }