a.t.ThreadQueue(TaskQueue) : class documentation

Part of asynqueue.threads View In Hierarchy Source for threads.py Project Page for AsynQueue

I am a TaskQueue for dispatching arbitrary callables to be run by a single worker thread.

Having one and just one worker thread is surprisingly useful. It lets you do synchronous processing without blocking Twisted's event loop, yet assures you that objects processed during one queued task will not be disturbed until completion of the Deferred callback chain from that task.

Method __init__ Undocumented
Method deferToThread No summary

Inherited from TaskQueue:

Method __len__ Returns my "length" as the number of workers currently at my disposal.
Method isRunning Returns True if shutdown has not been initiated and both my task handler and queue are running, False otherwise.
Method shutdown You must call this and wait for the Deferred it returns when you're done with me. Calls Queue.shutdown, among other things.
Method attachWorker Registers a new provider of IWorker for working on tasks from the queue.
Method detachWorker Detaches and terminates the worker supplied or specified by its ID, returning a Deferred that fires with a list of tasks left unfinished by the worker.
Method qualifyWorker Adds the specified series to the qualifications of the supplied worker.
Method workers Returns the worker object specified by ID, or None if that worker is not employed with me.
Method taskDone Processes the status/result tuple from a worker running a task. You don't need to call this directly.
Method newTask Make a new tasks.Task object from a func-args-kw combo. You won't call this directly.
Method call Queues up a function call.
Method update No summary
Method _getWorkerID Undocumented
def __init__(self, **kw):
Undocumented
def deferToThread(self, f, *args, **kw):

Runs the f-args-kw call in my dedicated worker thread, skipping past the queue. As with a regular TaskQueue.call, returns a Deferred that fires with the result and deals with iterators.

API Documentation for AsynQueue, generated by pydoctor at 2018-08-29 10:51:11.