-
Notifications
You must be signed in to change notification settings - Fork 535
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
Multiprocessing for stream processing #296
Comments
Hmm, in Celery we have an async version of the multiprocessing pool. One of the things that I want to do is to port that to asyncio. multiprocessing.Pool combines threads and fork, this can lead to deadlocks and other issues. I imagine you can already use multiprocessing.Pool with faust, as you can handle the blocking |
I was trying to push the data to multiprocessing queue to be processed by class inheriting mp.Process,it works with simple Queue,but with mp.Queue there is deadlock possibly because of the reason you mentioned. |
@learnermaxRL, I ended up using ThreadPool as message processing takes longer than required to speed up things. CONCURRENCY = cpu_count()
thread_pool = ThreadPoolExecutor(max_workers=CONCURRENCY)
# then you do
@app.agent(new_topic, concurrency=CONCURRENCY)
async def new_message(stream):
async for msg in stream:
await app.loop.run_in_executor(thread_pool, method, args) |
Any ideas how to use the stream data colected through batch to be utilised with Multiprocessing queue fpr further processing since its a blocking call?
The text was updated successfully, but these errors were encountered: