Thank you, "cancel" callback - stop running now what you've been asked to exec. Example: some SQL query that takes 5 min and I need to cancel it anywhere in the middle and it, of course, it doesn't matter what the result set.
As far as I see from base.py and client.py, some sort of timeout now could achieve the cancel operation ? Quoting "Jean-Paul Calderone" <exar...@divmod.com>: > On Tue, 14 Jul 2009 11:10:10 -0400, vit...@synapticvision.com wrote: >> Hello, >> >> is there any way to cancel the Deferred callback in those examples? >> >> 1. >> d = defer.Deferred() >> d.addCallback(methodA).addErrback(methodErr) >> d.callback(None) >> >> 2. >> d = methodB().addErrback(methodErr) >> wfd = defer.waitForDeferred(d) >> >> >> >> Appreciate any help. >> > > Deferred doesn't have any cancellation features. You can generally achieve > some sort of cancellation by supporting this in the application code creating > and consuming the Deferreds involved. > > The details of how to do this depend on what exactly you want to happen when > you "cancel" the operation. > > You can find one example of this in the implementation of Twisted's internal > thread-based name resolver: > > http://twistedmatrix.com/trac/browser/trunk/twisted/internet/base.py#L193 > > You can find other examples in the implementation of any other Deferred- > returning API which also supports timeouts, eg the web client: > > http://twistedmatrix.com/trac/browser/trunk/twisted/web/client.py#L198 > > Hope this helps, > > Jean-Paul > > _______________________________________________ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python