@@ -903,7 +903,7 @@ function _run_callbacks_concurrently(callbacks_name, callbacks_dict, warning_int
903
903
end
904
904
905
905
# Wait on the tasks so that exceptions bubble up
906
- wait .( values (callback_tasks))
906
+ foreach (wait, values (callback_tasks))
907
907
end
908
908
909
909
function _add_callback (f, key, dict; arg_types= Tuple{Int})
@@ -928,7 +928,7 @@ _remove_callback(key, dict) = delete!(dict, key)
928
928
"""
929
929
add_worker_starting_callback(f::Base.Callable; key=nothing)
930
930
931
- Register a callback to be called on the master process immediately before new
931
+ Register a callback to be called on the master worker immediately before new
932
932
workers are started. The callback `f` will be called with the `ClusterManager`
933
933
instance that is being used and a dictionary of parameters related to adding
934
934
workers, i.e. `f(manager, params)`. The `params` dictionary is specific to the
@@ -939,10 +939,12 @@ file for their definitions.
939
939
940
940
!!! warning
941
941
Adding workers can fail so it is not guaranteed that the workers requested
942
- will exist.
942
+ in `manager` will exist in the future. e.g. if a worker is requested on a
943
+ node that is unreachable then the worker-starting callbacks will be called
944
+ but the worker will never be added.
943
945
944
946
The worker-starting callbacks will be executed concurrently. If one throws an
945
- exception it will not be caught and will bubble up through [`addprocs`](@ref).
947
+ exception it will not be caught and will be rethrown by [`addprocs`](@ref).
946
948
947
949
Keep in mind that the callbacks will add to the time taken to launch workers; so
948
950
try to either keep the callbacks fast to execute, or do the actual work
@@ -961,13 +963,13 @@ remove_worker_starting_callback(key) = _remove_callback(key, worker_starting_cal
961
963
"""
962
964
add_worker_started_callback(f::Base.Callable; key=nothing)
963
965
964
- Register a callback to be called on the master process whenever a worker is
965
- added. The callback will be called with the added worker ID,
966
+ Register a callback to be called on the master worker whenever a worker has
967
+ been added. The callback will be called with the added worker ID,
966
968
e.g. `f(w::Int)`. Chooses and returns a unique key for the callback if `key` is
967
969
not specified.
968
970
969
971
The worker-started callbacks will be executed concurrently. If one throws an
970
- exception it will not be caught and will bubble up through [`addprocs()`](@ref).
972
+ exception it will not be caught and will be rethrown by [`addprocs()`](@ref).
971
973
972
974
Keep in mind that the callbacks will add to the time taken to launch workers; so
973
975
try to either keep the callbacks fast to execute, or do the actual
@@ -986,13 +988,13 @@ remove_worker_started_callback(key) = _remove_callback(key, worker_started_callb
986
988
"""
987
989
add_worker_exiting_callback(f::Base.Callable; key=nothing)
988
990
989
- Register a callback to be called on the master process immediately before a
991
+ Register a callback to be called on the master worker immediately before a
990
992
worker is removed with [`rmprocs()`](@ref). The callback will be called with the
991
993
worker ID, e.g. `f(w::Int)`. Chooses and returns a unique key for the callback
992
994
if `key` is not specified.
993
995
994
996
All worker-exiting callbacks will be executed concurrently and if they don't
995
- all finish before the `callback_timeout` passed to `rmprocs()` then the process
997
+ all finish before the `callback_timeout` passed to `rmprocs()` then the worker
996
998
will be removed anyway.
997
999
"""
998
1000
add_worker_exiting_callback (f:: Base.Callable ; key= nothing ) = _add_callback (f, key, worker_exiting_callbacks)
@@ -1007,7 +1009,7 @@ remove_worker_exiting_callback(key) = _remove_callback(key, worker_exiting_callb
1007
1009
"""
1008
1010
add_worker_exited_callback(f::Base.Callable; key=nothing)
1009
1011
1010
- Register a callback to be called on the master process when a worker has exited
1012
+ Register a callback to be called on the master worker when a worker has exited
1011
1013
for any reason (i.e. not only because of [`rmprocs()`](@ref) but also the worker
1012
1014
segfaulting etc). Chooses and returns a unique key for the callback if `key` is
1013
1015
not specified.
0 commit comments