Skip to content

Commit c6f4e94

Browse files
authored
Merge pull request #8 from mattwigway/cli-cookie
Pass cluster cookie to workers as std input rather than on command line
2 parents d43485b + 0823fb9 commit c6f4e94

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/slurmmanager.jl

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

52-
srun_cmd = `srun -D $exehome $exename $exeflags --worker=$(cluster_cookie())`
53-
manager.srun_proc = open(srun_cmd)
52+
# Pass cookie as stdin to srun; srun forwards stdin to process
53+
# 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)
56+
write(manager.srun_proc, cluster_cookie())
57+
write(manager.srun_proc, "\n")
5458

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

0 commit comments

Comments
 (0)