-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Making AstroidManager
interactable from multiple processes
#2048
Comments
If it were me, I'd want to just step through and profile the entire current implementation. I've yet to do that, so I really don't have a forecast at this point. My worry is that we're unnecessarily building a lot of unnecessary astroid asts. If five python modules import pandas, are we building an ast for pandas five times? |
Thanks for the link. I think with the SyncManager we'll run into trouble with unpickable objects. I did see, this, though:
Do you mind if I give this a spin? |
I was able to pickle most objects with |
That's what I was referring to: Lines 56 to 57 in 5fa9089
|
Perhaps:
That way worker processes never have to update shared state. 🤔 |
I did this, but this gives minimal gain. The creation of an What we should "cache"/parallelize is |
Do you have an experimental branch where you tried this stuff? If the bottleneck really is somewhere else it would be instructive to profile it and find out where it's lurking instead. EDIT: ah, you did say you expect the bottleneck to be in inferring import nodes. |
Sadly I don't as the code wasn't achieving what I tried to do, so I deleted it 😅 |
I know, another issue about multiprocessing...
I was reading up on multiprocessing and sharing caches among those processes and it seems as if we need something like
multiprocessing.SyncManager
to allow accessing a cache between multiple processes.I think it would be worthwhile to explore whether we can make
AstroidManager
aSyncManager
that needs to be instantiated by whoever needs it rather than having it be a singleton.However, before spending considerable time exploring this I want to see if others have had tries at this or other ideas about allowing
pylint
andastroid
to "parse modules and nodes in multiple process while keeping a cache between those processes".Taggin @jacobtylerwalls in particular as they have tinkered with this as well.
The text was updated successfully, but these errors were encountered: