|
11 | 11 | my_errormonitor(t) = nothing
|
12 | 12 | end
|
13 | 13 |
|
| 14 | +""" |
| 15 | + ElasticManager <: Distributed.ClusterManager |
| 16 | +
|
| 17 | +A cluster manager that allows for adding and removing workers dynamically. |
| 18 | +
|
| 19 | +Constructor: |
| 20 | +
|
| 21 | +```julia |
| 22 | +function ElasticManager(; |
| 23 | + addr=IPv4("127.0.0.1"), port=9009, cookie=nothing, |
| 24 | + topology=:all_to_all, manage_callback=elastic_no_op_callback, printing_kwargs=() |
| 25 | +) |
| 26 | +``` |
| 27 | +
|
| 28 | +The manager will listen for worker connections on `addr:port`. Workers have |
| 29 | +to authenticate themselves with `cookie` (randomly generated by default). |
| 30 | +
|
| 31 | +If `manage_callback` is set to a user-provided `my_manage_callback`, it will |
| 32 | +be called on the primary Julia process when `Distributed.manage` adds or |
| 33 | +removes an elastic worker. The callback signature is |
| 34 | +
|
| 35 | +```julia |
| 36 | +my_manage_callback(mgr::ElasticManager, id::Integer, :register) |
| 37 | +my_manage_callback(mgr::ElasticManager, id::Integer, :deregister) |
| 38 | +``` |
| 39 | +
|
| 40 | +This can be used to automatically add workers to a `Distributed.WorkerPool`, |
| 41 | +and so on. |
| 42 | +""" |
14 | 43 | struct ElasticManager <: Distributed.ClusterManager
|
15 | 44 | active::Dict{Int, Distributed.WorkerConfig} # active workers
|
16 | 45 | pending::Channel{Sockets.TCPSocket} # to be added workers
|
@@ -57,9 +86,9 @@ struct ElasticManager <: Distributed.ClusterManager
|
57 | 86 | end
|
58 | 87 | end
|
59 | 88 |
|
60 |
| -ElasticManager(port) = ElasticManager(;port=port) |
61 |
| -ElasticManager(addr, port) = ElasticManager(;addr=addr, port=port) |
62 |
| -ElasticManager(addr, port, cookie) = ElasticManager(;addr=addr, port=port, cookie=cookie) |
| 89 | +@deprecate ElasticManager(port) ElasticManager(;port=port) |
| 90 | +@deprecate ElasticManager(addr, port) ElasticManager(;addr=addr, port=port) |
| 91 | +@deprecate ElasticManager(addr, port, cookie) ElasticManager(;addr=addr, port=port, cookie=cookie) |
63 | 92 |
|
64 | 93 | elastic_no_op_callback(::ElasticManager, ::Integer, ::Symbol) = nothing
|
65 | 94 |
|
|
0 commit comments