Skip to content
Snippets Groups Projects
Commit 608f57d7 authored by Morris Jette's avatar Morris Jette
Browse files

Set SLURM_JOB_USER & UID for task_epilog

bug 521
parent 3cc5f9e1
No related branches found
No related tags found
No related merge requests found
...@@ -838,6 +838,18 @@ int setup_env(env_t *env, bool preserve_env) ...@@ -838,6 +838,18 @@ int setup_env(env_t *env, bool preserve_env)
rc = SLURM_FAILURE; rc = SLURM_FAILURE;
} }
if (env->user_name) {
if (setenvf(&env->env, "SLURM_JOB_UID", "%u",
(unsigned int) env->uid)) {
error("Can't set SLURM_JOB_UID env variable");
rc = SLURM_FAILURE;
}
if (setenvf(&env->env, "SLURM_JOB_USER", "%s", env->user_name)){
error("Can't set SLURM_JOB_USER env variable");
rc = SLURM_FAILURE;
}
}
return rc; return rc;
} }
......
...@@ -78,6 +78,8 @@ typedef struct env_options { ...@@ -78,6 +78,8 @@ typedef struct env_options {
char *ckpt_dir; /* --ckpt-dir= */ char *ckpt_dir; /* --ckpt-dir= */
uint16_t restart_cnt; /* count of job restarts */ uint16_t restart_cnt; /* count of job restarts */
uint16_t batch_flag; /* 1 if batch: queued job with script */ uint16_t batch_flag; /* 1 if batch: queued job with script */
uint32_t uid; /* user ID */
char *user_name; /* user name */
} env_t; } env_t;
......
...@@ -365,6 +365,8 @@ exec_task(stepd_step_rec_t *job, int i) ...@@ -365,6 +365,8 @@ exec_task(stepd_step_rec_t *job, int i)
job->envtp->distribution = -1; job->envtp->distribution = -1;
job->envtp->ckpt_dir = xstrdup(job->ckpt_dir); job->envtp->ckpt_dir = xstrdup(job->ckpt_dir);
job->envtp->batch_flag = job->batch; job->envtp->batch_flag = job->batch;
job->envtp->uid = job->uid;
job->envtp->user_name = xstrdup(job->user_name);
/* Modify copy of job's environment. Do not alter in place or /* Modify copy of job's environment. Do not alter in place or
* concurrent searches of the environment can generate invalid memory * concurrent searches of the environment can generate invalid memory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment