View source on GitHub |
A Queue following the same protocol as MultiFuture.
Inherits From: Future
, expected_type
google.appengine.ext.ndb.QueueFuture(
info=None
)
However, instead of returning results as a list, it lets you retrieve results as soon as they are ready, one at a time, using getq(). The Future itself finishes with a result of None when the last result is ready (regardless of whether it was retrieved).
The getq() method returns a Future which blocks until the next result is ready, and then returns that result. Each getq() call retrieves one unique result. Extra getq() calls after the last result is already returned return EOFError as their Future's exception. (I.e., q.getq() returns a Future as always, but yieding that Future raises EOFError.)
NOTE: Values can also be pushed directly via .putq(value). However there is no flow control -- if the producer is faster than the consumer, the queue will grow unbounded.
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()
getq
getq()
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
|