-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0.x] Make manager required in AstroidBuilder/InspectBuilder #2313
base: main
Are you sure you want to change the base?
[4.0.x] Make manager required in AstroidBuilder/InspectBuilder #2313
Conversation
938cbee
to
c9399bb
Compare
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #2313 +/- ##
==========================================
- Coverage 92.85% 92.84% -0.01%
==========================================
Files 94 94
Lines 11056 11043 -13
==========================================
- Hits 10266 10253 -13
Misses 790 790
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one bring a lot of joy. Were you able to use nodes.X
instead of X
thanks to the fixed circular imports ?
I didn't have a choice, because the second import statement [from nodes import ...] was failing because nodes was now partially installed at that point. I think before, it was an accident that nodes was fully initialized already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although really in favour, this do introduce more global state for AstroidManager()
, see also #2048.
As long as AstroidManager
is a singleton we'll keep accessing shared memory in multiprocessing scenarios. Ideally, to me, we would change it in 4.x
so that the manager needs to be instantiated.
Getting back up to speed on this to see if I can get it in for 4.0. @DanielNoord can you remind me what you meant by "more global state"? I'm not sure I follow. |
From my testing with multiprocessing on of the issues is that the cache of all nodes is stored on the manager, which means that we have a lot of dependency on this one shared object. Since it is global, and not passed or instantiated in I'm fine with this PR, but I do think at some point we need to look into making the manager something that is instantiated by the process that wants to do inference. |
Type of Changes
Description
Closes #251
Remove delayed imports in AstroidManager by requiring AstroidManager to be provided to AstroidBuilder/InspectBuilder.
A couple new delayed imports became necessary, but they're in helpers like
parse()
and_astroid_bootstrapping()
. We could address those by:_astroid_bootstrapping()
to manager.py.