From 3676fc8dc1f6ba6c32345c9d6a3484b726319696 Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Wed, 5 Jun 2019 12:04:03 -0700 Subject: [PATCH 1/2] surface publish future in documentation --- pubsub/docs/publisher/api/futures.rst | 6 ++++++ pubsub/docs/publisher/index.rst | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 pubsub/docs/publisher/api/futures.rst diff --git a/pubsub/docs/publisher/api/futures.rst b/pubsub/docs/publisher/api/futures.rst new file mode 100644 index 000000000000..b02b9bf9039d --- /dev/null +++ b/pubsub/docs/publisher/api/futures.rst @@ -0,0 +1,6 @@ +Futures +======= + +.. automodule:: google.cloud.pubsub_v1.publisher.futures + :members: + :inherited-members: diff --git a/pubsub/docs/publisher/index.rst b/pubsub/docs/publisher/index.rst index 16a869925184..a8485632c6f8 100644 --- a/pubsub/docs/publisher/index.rst +++ b/pubsub/docs/publisher/index.rst @@ -95,7 +95,7 @@ Futures ------- Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` returns -an instance of :class:`google.api_core.future.Future`. +an instance of :class:`~.pubsub_v1.publisher.futures.Future`. .. note:: @@ -135,3 +135,4 @@ API Reference :maxdepth: 2 api/client + api/futures From 74b2455a15d440032fd5cccdb68c825ce65e9aef Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Wed, 5 Jun 2019 14:29:31 -0700 Subject: [PATCH 2/2] Update class definition --- .../cloud/pubsub_v1/publisher/futures.py | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/pubsub/google/cloud/pubsub_v1/publisher/futures.py b/pubsub/google/cloud/pubsub_v1/publisher/futures.py index 8fec17d2d64f..ed200041177b 100644 --- a/pubsub/google/cloud/pubsub_v1/publisher/futures.py +++ b/pubsub/google/cloud/pubsub_v1/publisher/futures.py @@ -1,4 +1,4 @@ -# Copyright 2017, Google LLC All rights reserved. +# Copyright 2019, Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,22 +18,11 @@ class Future(futures.Future): - """Encapsulation of the asynchronous execution of an action. - - This object is returned from asychronous Pub/Sub publishing calls, and is - the interface to determine the status of those calls. - - This object should not be created directly, but is returned by other - methods in this library. - - Args: - completed (Optional[Any]): An event, with the same interface as - :class:`threading.Event`. This is provided so that callers - with different concurrency models (e.g. ``threading`` or - ``multiprocessing``) can supply an event that is compatible - with that model. The ``wait()`` and ``set()`` methods will be - used. If this argument is not provided, then a new - :class:`threading.Event` will be created and used. + """This future object is returned from asychronous Pub/Sub publishing + calls. + + Calling :meth:`result` will resolve the future by returning the message + ID, unless an error occurs. """ def result(self, timeout=None):