asynqueue.workers.AsyncWorker(object)
class documentation
Part of asynqueue.workers
(View In Hierarchy)
Known subclasses: mcmandelbrot.test.testbase.MockWireWorker
Implements interfaces: IWorker
I implement an IWorker
that runs
tasks in the Twisted main loop.
I run each tasks.Task
one at a time
but in a well-behaved non-blocking manner. If the task callable doesn't
return a Deferred
, it better get its work done fast. You just
can't get away with blocking in the Twisted main loop.
You can supply a series keyword containing a list of one or more task series that I am qualified to handle.
This class was mostly written for testing during development, but it helped keep the basic functions of a worker in mind. And who knows; it might be useful where you want the benefits of priority queueing without leaving the Twisted mindset even for a moment.
Method | __init__ | Constructs an instance of me with a util.DeferredLock . |
Method | setResignator | Undocumented |
Method | run | Implements IWorker.run ,
running the task in the main thread. The task callable must
not block. |
Method | stop | Implements IWorker.stop . |
Method | crash | There's no point to implementing this because the Twisted main loop will block along with any task you give this worker. |
Constructs an instance of me with a util.DeferredLock
.
Parameters | series | A list of one or more task series that this particular instance of me is qualified to handle. |
raw | Set True if you want raw iterators to be returned instead of
iteration.Deferator
instances. You can override this with the same keyword set
False in a call. |
Implements IWorker.run
,
running the task in the main thread. The task callable must
not block.