View source on GitHub |
A Future that depends on multiple other Futures.
Inherits From: Future
, expected_type
google.appengine.ext.ndb.MultiFuture(
info=None
)
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(
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.
Attributes | |
---|---|
state
|
Methods
add_callback
add_callback(
callback, *args, **kwds
)
add_dependent
add_dependent(
fut
)
add_immediate_callback
add_immediate_callback(
callback, *args, **kwds
)
check_success
check_success()
complete
complete()
done
done()
dump
dump()
dump_stack
dump_stack()
get_exception
get_exception()
get_result
get_result()
get_traceback
get_traceback()
putq
putq(
value
)
set_exception
set_exception(
exc, tb=None
)
set_result
set_result(
result
)
wait
wait()
wait_all
@classmethod
wait_all( futures )
wait_any
@classmethod
wait_any( futures )
Class Variables | |
---|---|
FINISHING |
2
|
IDLE |
0
|
RUNNING |
1
|