- 2.34.0 (latest)
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.1
- 2.28.0
- 2.27.3
- 2.26.1
- 2.25.2
- 2.23.1
- 2.22.0
- 2.21.5
- 2.20.3
- 2.19.8
- 2.18.4
- 2.17.1
- 2.16.1
- 2.15.2
- 2.14.1
- 2.13.12
- 2.12.1
- 2.11.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.1
- 2.6.1
- 2.5.0
- 2.4.2
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.7.2
- 1.6.1
- 1.5.0
- 1.4.3
- 1.3.1
- 1.2.0
- 1.1.0
- 1.0.2
- 0.45.0
- 0.44.0
- 0.43.0
Future(completed=None)This future object is returned from asychronous Pub/Sub publishing calls.
Calling result will resolve the future by returning the message
ID, unless an error occurs.
Methods
add_done_callback
add_done_callback(callback)Attach the provided callable to the future.
The provided function is called, with this future as its only argument, when the future finishes running.
| Parameter | |
|---|---|
| Name | Description |
callback |
Callable
The function to call. |
cancel
cancel()Actions in Pub/Sub generally may not be canceled.
This method always returns False.
cancelled
cancelled()Actions in Pub/Sub generally may not be canceled.
This method always returns False.
done
done()Return True the future is done, False otherwise.
This still returns True in failure cases; checking result or
exception is the canonical way to assess success or failure.
exception
exception(timeout=None)Return the exception raised by the call, if any.
| Parameter | |
|---|---|
| Name | Description |
timeout |
Union[int, float]
The number of seconds before this call times out and raises TimeoutError. |
| Exceptions | |
|---|---|
| Type | Description |
concurrent.futures.TimeoutError |
If the request times out. |
| Returns | |
|---|---|
| Type | Description |
Exception |
The exception raised by the call, if any. |
result
result(timeout=None)Return the message ID or raise an exception.
This blocks until the message has been published successfully and returns the message ID unless an exception is raised.
| Parameter | |
|---|---|
| Name | Description |
timeout |
Union[int, float]
The number of seconds before this call times out and raises TimeoutError. |
| Exceptions | |
|---|---|
| Type | Description |
concurrent.futures.TimeoutError |
If the request times out. |
Exception |
For undefined exceptions in the underlying call execution. |
| Returns | |
|---|---|
| Type | Description |
str |
The message ID. |
running
running()Actions in Pub/Sub generally may not be canceled.
| Returns | |
|---|---|
| Type | Description |
bool |
True if this method has not yet completed, or False if it has completed. |
set_exception
set_exception(exception)Set the result of the future to the given exception.
| Parameter | |
|---|---|
| Name | Description |
exception |
The exception raised. |
set_result
set_result(result)Set the result of the future to the provided result.
| Parameter | |
|---|---|
| Name | Description |
result |
Any
The result |