[Tutor] When to use multiprocessing Managers?

eryksun eryksun at gmail.com
Mon Mar 3 16:40:23 CET 2014


On Mon, Mar 3, 2014 at 6:45 AM, James Chapman <james at uplinkzero.com> wrote:
> Thanks for the explanation.
>
> Is there any reason or case you can think of where on a single system
> you would use the manager (proxied) queue over the multiprocessing
> (piped) queue?

Not really. But a manager also lets you share lists, dicts,
namespaces, or other registered types. Note that a proxy isn't thread
safe, so it should be used by only a single thread, or with a lock.

> The manager could potentially be extended to do some kind of data
> validation / error checking before submitting to the Queue. This could
> be important if the data going into the Queue was for example, user
> generated.

You could have another function that does that, or subclass
multiprocessing.queues.Queue to override its `put` method.


More information about the Tutor mailing list