google.appengine.ext.ndb.MultiFuture

A Future that depends on multiple other Futures.

Inherits From: Future, expected_type

This is used internally by 'v1, v2, ... = yield f1, f2, ...'; the semantics (e.g. error handling) are constrained by that use case.

The protocol from the caller's POV is::

mf = MultiFuture() mf.add_dependent() -OR- mf.putq() mf.add_dependent() -OR- mf.putq() . . (More mf.add_dependent() and/or mf.putq() calls) . mf.complete() # No more dependents will be added. . . (Time passes) . results = mf.get_result()

Now, results is a list of results from all dependent Futures in the order in which they were added.

It is legal to add the same dependent multiple times.

Callbacks can be added at any point.

From a dependent Future POV, there's nothing to be done: a callback is automatically added to each dependent Future which will signal its completion to the MultiFuture.

Error handling: if any dependent future raises an error, it is propagated to mf. To force an early error, you can call mf.set_exception() instead of mf.complete(). After this you can't call mf.add_dependent() or mf.putq() any more.

state

Methods

add_callback

View source

add_dependent

View source

add_immediate_callback

View source

check_success

View source

complete

View source

done

View source

dump

View source

dump_stack

View source

get_exception

View source

get_result

View source

get_traceback

View source

putq

View source

set_exception

View source

set_result

View source

wait

View source

wait_all

View source

wait_any

View source

FINISHING 2
IDLE 0
RUNNING 1