Change Distributed.cluster_manager from a global non-constant ClusterManager to a global constant Ref{ClusterManager}#177
Conversation
|
@JamesWrigley It looks like this isn't sufficient to fix the JET error. Example CI log: |
|
That being said, this might still be a good change to make, because it makes it a bit more explicit that the global exists, and isa ClusterManager. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #177 +/- ##
==========================================
+ Coverage 79.34% 79.38% +0.04%
==========================================
Files 10 10
Lines 1951 1955 +4
==========================================
+ Hits 1548 1552 +4
Misses 403 403 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
JET reports whenever a global variable that might be uninitialized is used.
const cluster_manager = Ref{ClusterManager}()
function subroutine()
isassigned(cluster_manager) || error("cluster manager uninitialized")
manager = cluster_manager[]
# use `manager`
endThis approach does not fundamentally solve the code design issue but exploits JET's permissive reporting approach though. |
|
@JamesWrigley What do you think? Should we go with the |
1ba667e to
aa41d8b
Compare
cluster_manager as a global non-constant variable with a type declaration (albeit an abstract type)Distributed.cluster_manager from a global non-constant ClusterManager to a global constant Ref{ClusterManager}
JamesWrigley
left a comment
There was a problem hiding this comment.
Sorry for the late review 😬 LGTM!
|
I think this is still an improvement over the previous code. |
|
@JamesWrigley Do you think this is a breaking change? We've changed the type of Is |
…terManager` to a global constant `Ref{ClusterManager}`
8a77120 to
d533b94
Compare
|
I'm pretty sure it isn't 🤔 It's not in the docs at least. @vchuravy, @jpsamaroo what do you think? |
|
We can revert if @vchuravy or @jpsamaroo think this is breaking. |
…terManager` to a global constant `Ref{ClusterManager}` (#177)
This is a forward-port of JuliaLang/Distributed.jl#177 (JuliaLang/Distributed.jl@2fe1aa4).
(cherry picked from commit 2fe1aa4e267517565e99cd06664550dcd230cfc6)
…#61096) Depends on: - [x] JuliaLang/Distributed.jl#177 - [x] Which will land on master in: #61109
…JuliaLang#61096) Depends on: - [x] JuliaLang/Distributed.jl#177 - [x] Which will land on master in: JuliaLang#61109
No description provided.