class documentation

class DeferredList(Deferred[_DeferredListResultListT]): (source)

View In Hierarchy

DeferredList is a tool for collecting the results of several Deferreds.

This tracks a list of Deferreds for their results, and makes a single callback when they have all completed. By default, the ultimate result is a list of (success, result) tuples, 'success' being a boolean. DeferredList exposes the same API that Deferred does, so callbacks and errbacks can be added to it in the same way.

DeferredList is implemented by adding callbacks and errbacks to each Deferred in the list passed to it. This means callbacks and errbacks added to the Deferreds before they are passed to DeferredList will change the result that DeferredList sees (i.e., DeferredList is not special). Callbacks and errbacks can also be added to the Deferreds after they are passed to DeferredList and DeferredList may change the result that they see.

See the documentation for the __init__ arguments for more information.

Method __init__ Initialize a DeferredList.
Method cancel Cancel this DeferredList.
Instance Variable consumeErrors Undocumented
Instance Variable finishedCount Undocumented
Instance Variable fireOnOneCallback Undocumented
Instance Variable fireOnOneErrback Undocumented
Instance Variable resultList No summary
Method _cbDeferred (internal) Callback for when one of my deferreds fires.
Instance Variable _deferredList The list of Deferreds to track.
def __init__(self, deferredList, fireOnOneCallback=False, fireOnOneErrback=False, consumeErrors=False): (source)
Initialize a DeferredList.
Parameters
deferredList:Iterable[Deferred[_DeferredResultT]]The deferreds to track.
fireOnOneCallback:bool(keyword param) a flag indicating that this DeferredList will fire when the first Deferred in deferredList fires with a non-failure result without waiting for any of the other Deferreds. When this flag is set, the DeferredList will fire with a two-tuple: the first element is the result of the Deferred which fired; the second element is the index in deferredList of that Deferred.
fireOnOneErrback:bool(keyword param) a flag indicating that this DeferredList will fire when the first Deferred in deferredList fires with a failure result without waiting for any of the other Deferreds. When this flag is set, if a Deferred in the list errbacks, the DeferredList will errback with a FirstError failure wrapping the failure of that Deferred.
consumeErrors:bool(keyword param) a flag indicating that failures in any of the included Deferreds should not be propagated to errbacks added to the individual Deferreds after this DeferredList is constructed. After constructing the DeferredList, any errors in the individual Deferreds will be converted to a callback result of None. This is useful to prevent spurious 'Unhandled error in Deferred' messages from being logged. This does not prevent fireOnOneErrback from working.
def cancel(self): (source)

Cancel this DeferredList.

If the DeferredList hasn't fired yet, cancel every Deferred in the list.

If the DeferredList has fired, including the case where the fireOnOneCallback/fireOnOneErrback flag is set and the DeferredList fires because one Deferred in the list fires with a non-failure/failure result, do nothing in the cancel method.

consumeErrors = (source)

Undocumented

finishedCount: int = (source)

Undocumented

fireOnOneCallback = (source)

Undocumented

fireOnOneErrback = (source)

Undocumented

The final result, in progress. Each item in the list corresponds to the Deferred at the same position in _deferredList. It will be None if the Deferred did not complete yet, or a (success, result) pair if it did.
def _cbDeferred(self, result, index, succeeded): (source)
(internal) Callback for when one of my deferreds fires.
Parameters
result:_DeferredResultTUndocumented
index:intUndocumented
succeeded:boolUndocumented
Returns
Optional[_DeferredResultT]Undocumented
_deferredList = (source)
The list of Deferreds to track.