[Twisted-Python] AsynQueue: return deferred from queued method

Stephan Jaeger stephan.jaeger at ewetel.de
Tue Aug 12 07:01:22 EDT 2008

Thanks for your answer Ed,

Am Montag, den 11.08.2008, 08:52 -0700 schrieb Ed Suominen:

> Just use a single implementer of IWorker that only accepts one 
> assignment at a time. The queue will not feed it its next task until the 
> deferred from its previous one has fired.

Would something like this be ok?

from zope.interface import implements
from asynqueue import IWorker

class DeferredWorker(object):
    cQualified = []
    def __init__(self):
        self.iQualified = []
    def run(self, task):
        self.task = task
        f, args, kw = task.callTuple
        d = f(*args, **kw)
        d.addCallbacks(task.callback, task.errback)
        return d

    def setResignator(self, callableObject):
        There's nothing that would make me resign.
    def stop(self):
    def crash(self):
        return self.task

At least it seems to do the job ;)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20080812/4fb2ec38/attachment.pgp 

More information about the Twisted-Python mailing list