File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,34 @@ the package `ClusterManagers.jl`.
359
359
The number of seconds a newly launched worker waits for connection establishment from the
360
360
master can be specified via variable `JULIA_WORKER_TIMEOUT` in the worker process's
361
361
environment. Relevant only when using TCP/IP as transport.
362
+
363
+ To launch workers without blocking the REPL, or the containing function
364
+ if launching workers programmatically, execute `addprocs` in its own task.
365
+
366
+ # Examples
367
+
368
+ ```
369
+ # On busy clusters, call `addprocs` asynchronously
370
+ t = @async addprocs(...)
371
+ ```
372
+
373
+ ```
374
+ # Utilize workers as and when they come online
375
+ if nprocs() > 1 # Ensure at least one new worker is available
376
+ .... # perform distributed execution
377
+ end
378
+ ```
379
+
380
+ ```
381
+ # Retrieve newly launched worker IDs, or any error messages
382
+ if istaskdone(t) # Check if `addprocs` has completed to ensure `fetch` doesn't block
383
+ if nworkers() == N
384
+ new_pids = fetch(t)
385
+ else
386
+ fetch(t)
387
+ end
388
+ end
389
+ ```
362
390
"""
363
391
function addprocs (manager:: ClusterManager ; kwargs... )
364
392
init_multi ()
You can’t perform that action at this time.
0 commit comments