multiprocessing: pool with blocking queue

J Kenneth King james at agentultra.com
Thu Jul 2 20:54:49 CEST 2009


masher <vertespain at gmail.com> writes:

> On Jul 2, 12:06 pm, J Kenneth King <ja... at agentultra.com> wrote:
>> masher <vertesp... at gmail.com> writes:
>> > My questions, then, is: Is there a more elegant/pythonic way of doing
>> > what I am trying to do with the current Pool class?
>>
>> Forgive me, I may not fully understand what you are trying to do here
>> (I've never really used multiprocessing all that much)...
>>
>> But couldn't you just assign your own Queue object to the Pool instance?
>
> That's basically my question. It does not appear as though there is
> any straightforward way of doing this because of the design of Pool's
> __init__ method, which passes _taskqueue to several functions. Hence,
> even if I were to reassign _taskqueue after __init__, that wouldn't
> change anything.

I think I understand.

There are ways to modify the class before instantiating it, but even the
most clever or elegant solution will still smell funny.  I suppose this
might be worth submitting as a feature suggestion to the multiprocessing
project.

Best of luck.



More information about the Python-list mailing list