[Twisted-Python] feeding-worker-loop problem

Phil Mayers p.mayers at imperial.ac.uk
Sat Apr 19 09:06:25 EDT 2008

> I'd like to have a number of workers which process these tasks from the
> queue.
> What I've got:
> - the worker, which returns a deferred for further processing
> - a worker-pool class, which hands out the workers with an attached
> callback to re-queue them to the "available-pool"

I don't understand that terminology.

What kind of objects are these workers? Threads? Sub-processes? Python 
generators? Long-lived functions (these would block the reactor)

> My problem:
> - the connection between the queue and the worker-pool and integrating
> this into the main reactor-loop
> My first thought was a twisted.internet.task.LoopingCall, trying to get
> a worker and on success giving it a task, but that's not very
> asynchronous, isn't it? Especially no when the queue is empty.
> I've no clue how to implement this.

I would suggest looking at this:


More information about the Twisted-Python mailing list