Python 2.7 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
A Future represents the result of an
asynchronous operation.
When created, it probably doesn't have any result data.
When the operation finishes, the Future gets the result.
An application can call a Future object's
get_result() method; if the result has arrived, the
method returns it; otherwise, it waits for the result to arrive and
then returns it.
Note: There is no 1:1 mapping between RPCs and Futures. Multiple futures might be tied to a result from a single RPC.
Instance Methods
check_success()
Check to see if the operation succeeded. Waits if necessary.
Raises an exception if there was a problem; returns None
if there was no problem.
done()
Returns True if the result (or exception) has arrived;
otherwise, returns False. This function does not wait.
get_exception()
Waits if necessary; then returns the exception (or None if
there was no exception). Returns the exception, doesn't raise it.
get_result()
Waits if necessary; then returns the result or raises the exception.
get_traceback()
Waits if necessary; then returns the exception's traceback
object (or None if there was no traceback object).
Python's
traceback module has functions to print and work with
traceback objects.
wait()
Waits until a result or exception arrives.
Always returns None.
Class Methods
wait_all(futures)
Wait until all Futures in the passed iterable are done.
Arguments
futures
Iterable of Future objects.
Returns None.
wait_any(futures)
Wait until at least one of a iterable of Futures is done.
Arguments
futures
Iterable of Future objects.
Returns one Future that is done.
(Returns None if the futures iterable is empty.)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-04 UTC."],[[["This page outlines how to utilize legacy bundled services and APIs, which are exclusive to first-generation runtimes within the App Engine standard environment."],["A `Future` object represents the outcome of an asynchronous operation and stores the result once the operation is complete."],["The `Future` object includes methods like `get_result()` to retrieve the result, `check_success()` to confirm the operation's success, and `done()` to check if the operation has finished."],["`wait_all` and `wait_any` are class methods that allow you to wait for multiple `Futures` to complete, either waiting for all to finish or waiting until at least one is done."]]],[]]