Skip to content

Commit 205fe3d

Browse files
committed
Document elastic_worker
Some use cases need to call elastic_worker, so it should be part of the API. Also rename stdout_to_master to forward_stdout, it's clearer. Non-breaking since stdout_to_master was never documented.
1 parent 8724c16 commit 205fe3d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/elastic.jl

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,33 @@ function Base.show(io::IO, mgr::ElasticManager)
148148
print(io, String(take!(iob)))
149149
end
150150

151-
# Does not return. If executing from a REPL try
152-
# @async elastic_worker(.....)
153-
# addr, port that a ElasticManager on the master processes is listening on.
151+
"""
152+
ElasticClusterManager.elastic_worker(
153+
cookie::AbstractString, addr::AbstractString="127.0.0.1", port::Integer = 9009;
154+
forward_stdout::Bool = true,
155+
Base.@nospecialize(env::AbstractVector = [],)
156+
)
157+
158+
Start an elastic worker process that connects to the main Julia process
159+
at IP-address `addr` and port `port`.
160+
161+
Does not return.
162+
"""
154163
function elastic_worker(
155164
cookie::AbstractString, addr::AbstractString="127.0.0.1", port::Integer = 9009;
156-
stdout_to_master::Bool = true,
165+
forward_stdout::Bool = true,
157166
Base.@nospecialize(env::AbstractVector = [],)
158167
)
159-
@debug "ElasticManager.elastic_worker(cookie, $addr, $port; stdout_to_master=$stdout_to_master, env=$env)"
168+
@debug "ElasticManager.elastic_worker(cookie, $addr, $port; forward_stdout=$forward_stdout, env=$env)"
160169
for (k, v) in env
161170
ENV[k] = v
162171
end
163172

164173
c = connect(addr, port)
165174
write(c, rpad(cookie, HDR_COOKIE_LEN)[1:HDR_COOKIE_LEN])
166-
stdout_to_master && redirect_stdout(c)
175+
if forward_stdout
176+
redirect_stdout(c)
177+
end
167178
Distributed.start_worker(c, cookie)
168179
end
169180

0 commit comments

Comments
 (0)