Skip to content

Commit

Permalink
Merge pull request #8 from mattwigway/cli-cookie
Browse files Browse the repository at this point in the history
Pass cluster cookie to workers as std input rather than on command line
  • Loading branch information
kleinhenz authored Nov 18, 2021
2 parents d43485b + 0823fb9 commit c6f4e94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/slurmmanager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ function launch(manager::SlurmManager, params::Dict, instances_arr::Array, c::Co
exename = params[:exename]
exeflags = params[:exeflags]

srun_cmd = `srun -D $exehome $exename $exeflags --worker=$(cluster_cookie())`
manager.srun_proc = open(srun_cmd)
# Pass cookie as stdin to srun; srun forwards stdin to process
# This way the cookie won't be visible in ps, top, etc on the compute node
srun_cmd = `srun -D $exehome $exename $exeflags --worker`
manager.srun_proc = open(srun_cmd, write=true, read=true)
write(manager.srun_proc, cluster_cookie())
write(manager.srun_proc, "\n")

t = @async for i in 1:manager.ntasks
manager.verbose && println("connecting to worker $i out of $(manager.ntasks)")
Expand Down

0 comments on commit c6f4e94

Please sign in to comment.