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

add limited launch/poe support for srun --export

--export=NONE is not supported, but --export=name=value is supported.
parent d0bec560
No related branches found
No related tags found
No related merge requests found
...@@ -756,12 +756,35 @@ extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, ...@@ -756,12 +756,35 @@ extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus,
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
static void _build_user_env(void)
{
char *tmp_env, *tok, *save_ptr = NULL, *eq_ptr, *value;
tmp_env = xstrdup(opt.export_env);
tok = strtok_r(tmp_env, ",", &save_ptr);
while (tok) {
if (!strcasecmp(tok, "NONE"))
break;
eq_ptr = strchr(tok, '=');
if (eq_ptr) {
eq_ptr[0] = '\0';
value = eq_ptr + 1;
setenv(tok, value, 1);
}
tok = strtok_r(NULL, ",", &save_ptr);
}
xfree(tmp_env);
}
extern int launch_p_step_launch( extern int launch_p_step_launch(
srun_job_t *job, slurm_step_io_fds_t *cio_fds, uint32_t *global_rc, srun_job_t *job, slurm_step_io_fds_t *cio_fds, uint32_t *global_rc,
slurm_step_launch_callbacks_t *step_callbacks) slurm_step_launch_callbacks_t *step_callbacks)
{ {
int rc = 0; int rc = 0;
if (opt.export_env)
_build_user_env();
poe_pid = fork(); poe_pid = fork();
if (poe_pid < 0) { if (poe_pid < 0) {
error("fork: %m"); error("fork: %m");
......
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