Skip to content

Commit 4eb6a50

Browse files
committed
Add support for params[:env]
1 parent 773a5d4 commit 4eb6a50

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/slurmmanager.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,17 @@ function launch(manager::SlurmManager, params::Dict, instances_arr::Array, c::Co
4949
exename = params[:exename]
5050
exeflags = params[:exeflags]
5151

52+
# Pass the key-value pairs from `params[:env]` to the `srun` command:
53+
srun_cmd_without_env = `srun -D $exehome $exename $exeflags --worker`
54+
env2 = Dict{String,String}()
55+
for (name, value) in pairs(Dict{String,String}(params[:env]))
56+
env2[name] = value
57+
end
58+
srun_cmd_with_env = addenv(srun_cmd_without_env, env2)
59+
5260
# Pass cookie as stdin to srun; srun forwards stdin to process
5361
# This way the cookie won't be visible in ps, top, etc on the compute node
54-
srun_cmd = `srun -D $exehome $exename $exeflags --worker`
55-
manager.srun_proc = open(srun_cmd, write=true, read=true)
62+
manager.srun_proc = open(srun_cmd_with_env, write=true, read=true)
5663
write(manager.srun_proc, cluster_cookie())
5764
write(manager.srun_proc, "\n")
5865

0 commit comments

Comments
 (0)