Skip to content

Commit 0f014f0

Browse files
authored
use === for comparison to nothing and Symbols (JuliaLang/julia#33764)
1 parent fd2ad7a commit 0f014f0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/cluster.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ end
146146
function check_worker_state(w::Worker)
147147
if w.state == W_CREATED
148148
if !isclusterlazy()
149-
if PGRP.topology == :all_to_all
149+
if PGRP.topology === :all_to_all
150150
# Since higher pids connect with lower pids, the remote worker
151151
# may not have connected to us yet. Wait for some time.
152152
wait_for_conn(w)
@@ -448,7 +448,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
448448
params = merge(default_addprocs_params(), AnyDict(kwargs))
449449
topology(Symbol(params[:topology]))
450450

451-
if PGRP.topology != :all_to_all
451+
if PGRP.topology !== :all_to_all
452452
params[:lazy] = false
453453
end
454454

@@ -616,7 +616,7 @@ function create_worker(manager, wconfig)
616616
# - On master, receiving a JoinCompleteMsg triggers rr_ntfy_join (signifies that worker setup is complete)
617617

618618
join_list = []
619-
if PGRP.topology == :all_to_all
619+
if PGRP.topology === :all_to_all
620620
# need to wait for lower worker pids to have completed connecting, since the numerical value
621621
# of pids is relevant to the connection process, i.e., higher pids connect to lower pids and they
622622
# require the value of config.connect_at which is set only upon connection completion
@@ -627,7 +627,7 @@ function create_worker(manager, wconfig)
627627
end
628628
end
629629

630-
elseif PGRP.topology == :custom
630+
elseif PGRP.topology === :custom
631631
# wait for requested workers to be up before connecting to them.
632632
filterfunc(x) = (x.id != 1) && isdefined(x, :config) &&
633633
(notnothing(x.config.ident) in something(wconfig.connect_idents, []))
@@ -832,7 +832,7 @@ julia> workers()
832832
```
833833
"""
834834
function nprocs()
835-
if myid() == 1 || (PGRP.topology == :all_to_all && !isclusterlazy())
835+
if myid() == 1 || (PGRP.topology === :all_to_all && !isclusterlazy())
836836
n = length(PGRP.workers)
837837
# filter out workers in the process of being setup/shutdown.
838838
for jw in PGRP.workers
@@ -885,7 +885,7 @@ julia> procs()
885885
```
886886
"""
887887
function procs()
888-
if myid() == 1 || (PGRP.topology == :all_to_all && !isclusterlazy())
888+
if myid() == 1 || (PGRP.topology === :all_to_all && !isclusterlazy())
889889
# filter out workers in the process of being setup/shutdown.
890890
return Int[x.id for x in PGRP.workers if isa(x, LocalProcess) || (x.state == W_CONNECTED)]
891891
else
@@ -894,7 +894,7 @@ function procs()
894894
end
895895

896896
function id_in_procs(id) # faster version of `id in procs()`
897-
if myid() == 1 || (PGRP.topology == :all_to_all && !isclusterlazy())
897+
if myid() == 1 || (PGRP.topology === :all_to_all && !isclusterlazy())
898898
for x in PGRP.workers
899899
if (x.id::Int) == id && (isa(x, LocalProcess) || (x::Worker).state == W_CONNECTED)
900900
return true
@@ -1120,7 +1120,7 @@ function deregister_worker(pg, pid)
11201120
if myid() == 1 && (myrole() === :master) && isdefined(w, :config)
11211121
# Notify the cluster manager of this workers death
11221122
manage(w.manager, w.id, w.config, :deregister)
1123-
if PGRP.topology != :all_to_all || isclusterlazy()
1123+
if PGRP.topology !== :all_to_all || isclusterlazy()
11241124
for rpid in workers()
11251125
try
11261126
remote_do(deregister_worker, rpid, pid)

src/managers.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ end
226226

227227

228228
function manage(manager::SSHManager, id::Integer, config::WorkerConfig, op::Symbol)
229-
if op == :interrupt
229+
if op === :interrupt
230230
ospid = config.ospid
231231
if ospid !== nothing
232232
host = notnothing(config.host)
@@ -340,7 +340,7 @@ function launch(manager::LocalManager, params::Dict, launched::Array, c::Conditi
340340
end
341341

342342
function manage(manager::LocalManager, id::Integer, config::WorkerConfig, op::Symbol)
343-
if op == :interrupt
343+
if op === :interrupt
344344
kill(config.process, 2)
345345
end
346346
end

0 commit comments

Comments
 (0)