Skip to content
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

allow multiprocess dep instead of multiprocessing #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lalo
Copy link
Contributor

@lalo lalo commented Jun 10, 2022

multiprocess external lib has other benefits like using dill instead of pickle, allowing us more leeway on certain edge cases that are not compatible with native multiprocessing.

https://github.com/uqfoundation/multiprocess

from their readme:

multiprocess enables:

objects to be transferred between processes using pipes or multi-producer/multi-consumer queues
objects to be shared between processes using a server process or (for simple data) shared memory

multiprocess provides:

equivalents of all the synchronization primitives in threading
a Pool class to facilitate submitting tasks to worker processes
enhanced serialization, using dill

Let me know your thoughts on this type of change. Happy to iterate on it.

Thanks

Related: #53

@cgarciae
Copy link
Owner

cgarciae commented Mar 7, 2023

I wonder why CI didn't trigger.

@cgarciae
Copy link
Owner

cgarciae commented Mar 7, 2023

Hey @lalo, sorry for being out so long.
I like the change but I'd prefer if this was under a configuration flag, it could also be generalized to other implementations e.g:

from pypeln import config
import multiprocess

config.set_multiprocessing_impl(multiprocess)

@lalo
Copy link
Contributor Author

lalo commented Mar 7, 2023

I'll take a look

@@ -18,13 +23,13 @@

class IterableQueue(Queue, tp.Generic[T], tp.Iterable[T]):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this inheritance of Queue might complicate things

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typehints should stay the same, the important thing would be to use a different module when initializing Queue and Process at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heres a wip impl #100

@lalo lalo closed this Mar 17, 2023
@lalo lalo reopened this Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants