[Twisted-Python] Re: DeferredList and errbacks
exarkun at divmod.com
Thu Apr 21 15:02:56 EDT 2005
On 21 Apr 2005 14:39:38 -0400, David Bolen <db3l at fitlinxx.com> wrote:
>Andrew Bennetts <andrew-twisted at puzzling.org> writes:
>> By default, DeferredList waits for all its Deferreds to fire (with a result
>> or an error), and returns a big list of results of the form:
>> [(success_bool, value), (success_bool, value), ...]
>> Where 'success_bool' is True if the corresponding Deferred succeeded (i.e.
>> fired a callback), and False if it failed (i.e. fired an errback). 'value'
>> will be a result or a Failure instance accordingly. So a standard
>> DeferredList will never call errback, because it includes errors in the
>> result passed to its callback.
>Note however, that while the DeferredList will never errback, it
>doesn't stop the errback chains of the individual deferreds. It
>inserts itself into those chains to gather the information, but
>continues to let the failure propagate.
>So if you expect the DeferredList to be the final aggregation of
>information for all of the individual deferreds, but don't want
>unterminated errbacks (which often, but not always, result in default
>logging), you still need to install additional errbacks on each of the
>deferreds you hand to the DeferredList. And you need to add them
>after the deferreds are installed in the DeferredList or its the
>result of your individual errbacks that will flow to the DeferredList
Alternatively, pass consumeErrors=True to DeferredList() and it will do something equivalent for all Deferreds you put into it.
More information about the Twisted-Python