[Python-ideas] Add an introspection API to Executor

Dan O'Reilly oreilldf at gmail.com
Tue Aug 26 04:51:18 CEST 2014


The IntrospectableQueue idea seems reasonable to me. I think I would prefer
passing an introspectable (or similar) keyword to the Executor rather than
a queue class, though. Adding support for identifying which tasks are
active introduces some extra overhead, which I think can reasonably be made
optional. If we're going to use a different Queue class to enable
introspection, we might as well disable the other stuff that we're doing to
make introspection work. It also makes it easier to raise an exception if
an API is called that won't work without IntrospectableQueue being used.

>> Does Jython have to use a mutex and a deque instead of a more efficient
(and possibly lock-free) queue from the Java stdlib?

For what it's worth, Jython just uses CPython's queue.Queue implementation,
as far as I can tell.

>> What does multiprocessing.Queue do on each implementation?

In addition to a multiprocessing.Queue, the ProcessPoolExecutor maintains a
dict of all submitted work items, so that can be used instead of trying to
inspect the queue itself.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140825/a1e739c1/attachment.html>


More information about the Python-ideas mailing list