App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.ext.ndb.tasklets.MultiFuture Class Reference
Inheritance diagram for google.appengine.ext.ndb.tasklets.MultiFuture:
google.appengine.ext.ndb.tasklets.Future

Public Member Functions

def __init__
 
def __repr__
 
def complete
 
def set_exception
 
def putq
 
def add_dependent
 
- Public Member Functions inherited from google.appengine.ext.ndb.tasklets.Future
def __init__
 
def __repr__
 
def dump
 
def dump_stack
 
def add_callback
 
def add_immediate_callback
 
def set_result
 
def set_exception
 
def done
 
def state
 
def wait
 
def get_exception
 
def get_traceback
 
def check_success
 
def get_result
 
def wait_any
 
def wait_all
 

Additional Inherited Members

- Static Public Attributes inherited from google.appengine.ext.ndb.tasklets.Future
 IDLE = apiproxy_rpc.RPC.IDLE
 
 RUNNING = apiproxy_rpc.RPC.RUNNING
 
 FINISHING = apiproxy_rpc.RPC.FINISHING
 

Detailed Description

A Future that depends on multiple other Futures.

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(<some other Future>)  -OR- mf.putq(<some value>)
  mf.add_dependent(<some other Future>)  -OR- mf.putq(<some value>)
    .
    . (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.

The documentation for this class was generated from the following file: