Python 3.9 is now generally available.

google.appengine.ext.ndb.SerialQueueFuture

Like QueueFuture but maintains the order of insertion.

Inherits From: Future, expected_type

This class is used by Query operations.

Invariants:

  • At least one of _queue and _waiting is empty.
  • The Futures in _waiting are always pending.

(The Futures in _queue may be pending or completed.)

In the discussion below, add_dependent() is treated the same way as putq().

If putq() is ahead of getq(), the situation is like this:

                   putq()
                   v

_queue: [f1, f2, ...]; _waiting: [] ^ getq()

Here, putq() appends a Future to the right of _queue, and getq() removes one from the left.

If getq() is ahead of putq(), it's like this:

        putq()
        v

_queue: []; _waiting: [f1, f2, ...] ^ getq()

Here, putq() removes a Future from the left of _waiting, and getq() appends one to the right.

When both are empty, putq() appends a Future to the right of _queue, while getq() appends one to the right of _waiting.

The _full flag means that no more calls to putq() will be made; it is set by calling either complete() or set_exception().

Calling complete() signals that no more putq() calls will be made. If getq() is behind, subsequent getq() calls will eat up _queue until it is empty, and after that will return a Future that passes EOFError (note that getq() itself never raises EOFError). If getq() is ahead when complete() is called, the Futures in _waiting are all passed an EOFError exception (thereby eating up _waiting).

If, instead of complete(), set_exception() is called, the exception and traceback set there will be used instead of EOFError.

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

getq

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