-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Pathos for multiprocessing? #330
Comments
Hey @mcharytoniuk, thank you for reaching out before opening a PR. Whereas I'm not against introducing additional support for pickling resources, I'm not exactly thrilled of adding several additional dependencies into Granian: this will implicitly add the same deps on every framework/library/project using Granian, which is not (in my opinion) a good experience. Also, given the default Granian loader imports the targeted application on workers startup, I don't really get why Given all this, I won't object to an implementation which will just provide the necessary pickle hacks to move objects between workers, if that implementation won't relay on several 3rd party dependencies and it will also document the risks connected to this usage. |
@gi0baro Will you be okay with factoring Also, when it comes to the use cases, I want to experiment with hosting a Pytorch ML model. I want to load it into VRAM and only then fork the child processes so each one can access a handle through some mutex lock. An experiment-true, but I have some other ideas that would benefit from being able to swap |
Looks reasonable.
Given that's the use-case, I hardly doubt spawning multiple Granian workers will produce any benefit. |
@gi0baro OK, I will prepare a PR that factors I agree with your point about performance—Granian won't be a bottleneck. I want to experiment some more with it and explore the options. I am a fan of having the entire application in a single codebase, and Granian allows me to do just that. Thanks for the answer! |
Hello!
My application works fine when using
fork,
butpickle
causes serialization issues when usingspawn.
Will you be open to switching to either
pathos
instead ofmultiprocessing
?If so, I will be happy to contribute it. I just wanted to ask upfront to be sure it's ok. : )
Best wishes
The text was updated successfully, but these errors were encountered: