multiprocessing, pool, queue length

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 21 17:24:42 EDT 2016


On Mon, Mar 21, 2016 at 1:46 PM, Michael Welle <mwe012008 at gmx.net> wrote:
> Wait on the result means to set a multiprocessing.Event if one of the
> consumers finds the sentinel task and wait for it on the producer? Hmm,
> that might be better than incrementing a counter. But still, it couples
> the consumers and the producer more than I like.

No, I mean calling AsyncResult.wait() on the result of the sentinel
task (or just calling Pool.apply instead of Pool.apply_async in the
first place).

> Another idea that I had is to use map() instead of map_async() and then
> put the producer in its own process. That should work if job creation is
> fast.

Essentially the same thing.



More information about the Python-list mailing list