diff --git a/NEWS b/NEWS index 8c4cfdb2d31787bbfc053dad54349e9479c0149f..bb4989ccc8e5afe3a38259fa433befacd2e26eb3 100644 --- a/NEWS +++ b/NEWS @@ -55,8 +55,10 @@ documents those changes that are of interest to users and administrators. -- Fix incorrect casting when [un]packing derived_ec on slurmdb_job_rec_t. -- Document that persistent burst buffers can not be created or destroyed using the salloc or srun --bb options. - -- Document that the SLURM_JOB_ACCOUNT and SLURM_JOB_QOS environment variables - are set for the salloc and sbatch commands in their man pages. + -- Add support for setting the SLURM_JOB_ACCOUNT, SLURM_JOB_QOS and + SLURM_JOB_RESERVAION environment variables are set for the srun command. + Document the same environment variables for the salloc, sbatch and srun + commands in their man pages. * Changes in Slurm 16.05.3 ========================== diff --git a/doc/man/man1/salloc.1 b/doc/man/man1/salloc.1 index ab715c9c32b071a0773367472b7f3275c9649fc7..31c2e66b5158c3fe7c7bdc9d6267c4ca220c273b 100644 --- a/doc/man/man1/salloc.1 +++ b/doc/man/man1/salloc.1 @@ -1589,6 +1589,9 @@ Name of the partition in which the job is running. \fBSLURM_JOB_QOS\fR Quality Of Service (QOS) of the job allocation. .TP +\fBSLURM_JOB_RESERVATION\fR +Advanced reservation containing the job allocation, if any. +.TP \fBSLURM_MEM_BIND\fR Set to value of the \-\-mem_bind\fR option. .TP diff --git a/doc/man/man1/sbatch.1 b/doc/man/man1/sbatch.1 index def6b677f244e1916c34e76d6463d6a1d7dd9521..b64dc99d758dd3c9626207ca56ff316d0b75ba48 100644 --- a/doc/man/man1/sbatch.1 +++ b/doc/man/man1/sbatch.1 @@ -1895,6 +1895,9 @@ Name of the partition in which the job is running. \fBSLURM_JOB_QOS\fR Quality Of Service (QOS) of the job allocation. .TP +\fBSLURM_JOB_RESERVATION\fR +Advanced reservation containing the job allocation, if any. +.TP \fBSLURM_LOCALID\fR Node local task ID for the process within a job. .TP diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1 index 21a74679495d3c49f37bfad3ac9762f142bd65ef..dca039fa424f3d037fd0dda4ef1ff7e883529354 100644 --- a/doc/man/man1/srun.1 +++ b/doc/man/man1/srun.1 @@ -2610,6 +2610,9 @@ with \-m, \-\-distribution. Global task IDs running on this node. Zero origin and comma separated. .TP +\fBSLURM_JOB_ACCOUNT\fR +Account name associated of the job allocation. +.TP \fBSLURM_JOB_CPUS_PER_NODE\fR Number of CPUS per node. .TP @@ -2629,6 +2632,13 @@ create a job step (i.e. within an existing job allocation). \fBSLURM_JOB_PARTITION\fR Name of the partition in which the job is running. +.TP +\fBSLURM_JOB_QOS\fR +Quality Of Service (QOS) of the job allocation. +.TP +\fBSLURM_JOB_RESERVATION\fR +Advanced reservation containing the job allocation, if any. + .TP \fBSLURM_LAUNCH_NODE_IPADDR\fR IP address of the node from which the task launch was diff --git a/src/common/env.c b/src/common/env.c index 638eb2e9d4bfd106937be0081cb1a05ae8de1c8b..3da60d990d85d34c6cf4175934357fcf0266068e 100644 --- a/src/common/env.c +++ b/src/common/env.c @@ -1100,6 +1100,19 @@ env_array_for_job(char ***dest, const resource_allocation_response_msg_t *alloc, env_array_overwrite_fmt(dest, "SLURM_TASKS_PER_NODE", "%s", tmp); xfree(tmp); + if (alloc->account) { + env_array_overwrite_fmt(dest, "SLURM_JOB_ACCOUNT", + "%s", alloc->account); + } + if (alloc->qos) { + env_array_overwrite_fmt(dest, "SLURM_JOB_QOS", + "%s", alloc->qos); + } + if (alloc->resv_name) { + env_array_overwrite_fmt(dest, "SLURM_JOB_RESERVATION", + "%s", alloc->resv_name); + } + if (alloc->env_size) { /* Used to set Burst Buffer environment */ for (i = 0; i < alloc->env_size; i++) { tmp = xstrdup(alloc->environment[i]);