-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
| ~concurrent.futures.Future: An object conforming to the |
Contrary to what's in the reference, the correct return type for publish() should be google.cloud.pubsub_v1.publisher.futures.Future. I didn't find a reference for it but only some reference for google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture.
People won't be able to use of Python's concurrent library's wait() method on google.cloud.pubsub_v1.publisher.futures.Future. But our doc implies they can because we say the return type is concurrent.futures.Future.
from concurrent.futures import wait
from google.cloud import pubsub_v1
publisher = pubsub_v1.PublisherClient()
# future has type `google.cloud.pubsub_v1.publisher.futures.Future`
future = publisher.publish('projects/{PROJECT_ID}/topics/{TOPIC_NAME}', data=b'rain')
# wait(fs, timeout=None, return_when='ALL_COMPLETED') expects a sequence of `concurrent.futures.Future`.
wait([future])Here is the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 257, in wait
with _AcquireFutures(fs):
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 146, in __enter__
future._condition.acquire()
AttributeError: 'Future' object has no attribute '_condition'I tried in both Python 2 and 3.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.