API
ExistingProcessManagers.julia_worker_regexExistingProcessManagers.ExistingProcessManagerExistingProcessManagers.ExistingProcessManagerExistingProcessManagers.ExistingProcessManagerExistingProcessManagers.addprocs_existingExistingProcessManagers.hosts_and_ports_to_workerconfigsExistingProcessManagers.parse_julia_worker_output_to_hosts_and_ports
ExistingProcessManagers.julia_worker_regex — Constantjulia_worker_regexRegex for parsing the output printed by Julia worker processes.
ExistingProcessManagers.ExistingProcessManager — TypeSummary
struct ExistingProcessManager <: Distributed.ClusterManager
Fields
- wconfigs :: Vector{Distributed.WorkerConfig}
ExistingProcessManager(wconfigs::Vector{Distributed.WorkerConfig})Construct an ExistingProcessManager from a list of WorkerConfigs.
Example
julia> w1 = WorkerConfig();
julia> w1.host = "127.0.0.1";
julia> w1.port = 9601;
julia> w2 = WorkerConfig();
julia> w2.host = "127.0.0.1";
julia> w2.port = 9602;
julia> wconfigs = WorkerConfig[w1, w2];
julia> manager = ExistingProcessManager(wconfigs);Now you can do:
julia> addprocs(manager)ExistingProcessManagers.ExistingProcessManager — MethodExistingProcessManager(worker_output::AbstractString)Construct an ExistingProcessManager from the output printed by Julia worker processes.
Example
julia> worker_output = """
julia_worker:9960#192.168.1.151
julia_worker:9960#192.168.1.151
julia_worker:9960#192.168.1.151
julia_worker:9966#192.168.1.157
julia_worker:9968#192.168.1.159
""";
julia> manager = ExistingProcessManager(worker_output);Now you can do:
julia> addprocs(manager)ExistingProcessManagers.ExistingProcessManager — MethodExistingProcessManager(hosts_and_ports::Vector{Tuple{String, Int}})Construct an ExistingProcessManager from a list of hosts and port numbers.
Example
julia> hosts_and_ports = [
("127.0.0.1", 9601), # the host is "127.0.0.1", and the port number is 9601
("127.0.0.1", 9602), # the host is "127.0.0.1", and the port number is 9602
];
julia> manager = ExistingProcessManager(hosts_and_ports);Now you can do:
julia> addprocs(manager)ExistingProcessManagers.addprocs_existing — Methodaddprocs_existing(x; kwargs...)Equivalent to addprocs(ExistingProcessManager(x); kwargs...).
Examples
Example 1
julia> hosts_and_ports = [
("127.0.0.1", 9601), # the host is "127.0.0.1", and the port number is 9601
("127.0.0.1", 9602), # the host is "127.0.0.1", and the port number is 9602
]
2-element Vector{Tuple{String, Int64}}:
("127.0.0.1", 9601)
("127.0.0.1", 9602)
julia> addprocs_existing(hosts_and_ports; kwargs...)Example 2
julia> w1 = WorkerConfig();
julia> w1.host = "127.0.0.1";
julia> w1.port = 9601;
julia> w2 = WorkerConfig();
julia> w2.host = "127.0.0.1";
julia> w2.port = 9602;
julia> wconfigs = WorkerConfig[w1, w2];
julia> addprocs_existing(wconfigs; kwargs...)Example 3
julia> worker_output = """
julia_worker:9960#192.168.1.151
julia_worker:9960#192.168.1.151
julia_worker:9960#192.168.1.151
julia_worker:9966#192.168.1.157
julia_worker:9968#192.168.1.159
""";
julia> addprocs_existing(worker_output; kwargs...)ExistingProcessManagers.hosts_and_ports_to_workerconfigs — Methodhosts_and_ports_to_workerconfigs(hosts_and_ports::Vector{Tuple{String, Int}})Convert a list of hosts and port numbers to a list of WorkerConfigs.
Example
julia> hosts_and_ports = [
("127.0.0.1", 9601), # the host is "127.0.0.1", and the port number is 9601
("127.0.0.1", 9602), # the host is "127.0.0.1", and the port number is 9602
];
julia> wconfigs = hosts_and_ports_to_workerconfigs(hosts_and_ports);Now you can do either of the following two options, which are equivalent:
Option 1:
julia> addprocs(ExistingProcessManager(wconfigs))Option 2:
julia> addprocs_existing(wconfigs)ExistingProcessManagers.parse_julia_worker_output_to_hosts_and_ports — Methodparse_julia_worker_output_to_hosts_and_ports(; regex = julia_worker_regex)Parse the output printed by Julia workers and return a list of hosts and ports.
Example
julia> worker_output = """
julia_worker:9960#192.168.1.151
julia_worker:9962#192.168.1.153
julia_worker:9964#192.168.1.155
julia_worker:9966#192.168.1.157
julia_worker:9968#192.168.1.159
""";
julia> hosts_and_ports = parse_julia_worker_output_to_hosts_and_ports(worker_output);Now you can do either of the following two options, which are equivalent:
Option 1:
julia> addprocs(ExistingProcessManager(hosts_and_ports))Option 2:
julia> addprocs_existing(hosts_and_ports)