[slurm-users] prolog not passing env var to job

Herc Silverstein herc.silverstein at schrodinger.com
Fri Feb 12 23:02:46 UTC 2021


Thanks to everyone who replied!  It's working now.

I had to make a number of changes

1. set the env vars in the TaskProlog so that they are exported to the 
job/task  (I just had assumed that even though the Prolog is run under 
root and not the user id of the job that it would still end up passing 
the env vars down to the job/task)

2. use: "echo export ... "   and not just "export ..."

3. Some setup is needed in this case.  Do the setup in the Prolog script 
since (among other things) it needs to start up one process under root.

Herc

On 2/12/2021 1:27 PM, mercan wrote:
> Hi;
>
> Prolog and TaskProlog are different parameters and scripts. You should 
> use the TaskProlog script to set env. variables.
>
> Regards;
>
> Ahmet M.
>
>
> 13.02.2021 00:12 tarihinde Herc Silverstein yazdı:
>>
>> Hi,
>>
>> I have a prolog script that is being run via the slurm.conf Prolog= 
>> setting.  I've verified that it's being executed on the compute 
>> node.  My problem is that I cannot get environment variables that I 
>> set in this prolog to be set/seen in the job. For example the prolog:
>>
>> #!/bin/bash
>>
>> ...
>>
>> export CUDA_MPS_PIPE_DIRECTORY=blah
>>
>> ...
>>
>> is not part of the job's env vars.  Someone had suggested that a 
>> "print" statement needs to be used. So I tried:
>>
>> print export CUDA_MPS_PIPE_DIRECTORY=blah
>>
>> but this doesn't work either.  Is this is really just for print-ing 
>> as its name implies?  Or is that how one actually has to do it and 
>> somehow the syntax I'm using isn't quite right?
>>
>> The documentation says:
>>
>> /The task prolog is executed with the same environment as the user 
>> tasks to be initiated. The standard output of that program is read 
>> and processed as follows:/
>>
>> /export name=value//sets an environment variable for the user task//
>> / /unset name//clears an environment variable from the user task//
>> / /print ...//writes to the task's standard output.//
>> //The above functionality is limited to the task prolog script./
>>
>> Basically, I'd like to know how to get an arbitrary environment 
>> variable passed on to the job via the prolog.
>>
>> We are using slurm 20.02.5 on CentOS 7.
>>
>> Thanks,
>>
>> Herc
>>



More information about the slurm-users mailing list