[slurm-users] spank_job_control_setenv() doesn't seem to work for epilog scripts

Alberto Miranda alberto.miranda at bsc.es
Tue Jun 20 12:57:54 UTC 2023


Dear all,

I am writing a SPANK plugin to propagate several environment variables 
to `Prolog` and `Epilog` scripts but, so far, we have only managed to do 
so successfully for the former.

In our SPANK plugin we capture some information from the user using 
additional CLI flags and then export this information as environment 
variables in `slurm_spank_local_user_init()`:

```
int
slurm_spank_local_user_init(spank_t sp, int ac, char** av) {

     // ...

     // set some internal env vars required by the job's prolog/epilog
     if(spank_job_control_setenv(sp, "FOOBAR", "foobar", 1) != 
ESPANK_SUCCESS) {
         slurm_spank_log("failed to set FOOBAR env var");
         return -1;
     }

     /// ...
}
```

This works fine for the Prolog script (calling `env` from the scripts 
correctly reports a `SPANK_FOOBAR` environment variable with the 
appropriate value), but surprisingly doesn't work for the Epilog script, 
though the documentation in https://slurm.schedmd.com/spank.html implies 
otherwise.

Is this a bug or am I missing something?

Many thanks in advance.

cheers,
alberto



More information about the slurm-users mailing list