Skip to content

Commit

Permalink
Provide correct API for monitoring an LRO (database). (#4048)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesneeringer authored Sep 25, 2017
1 parent 24c22b2 commit f7947f1
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions docs/spanner/database-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,13 @@ Check on Current Database Operation
The :meth:`~google.cloud.spanner.database.Database.create` and
:meth:`~google.cloud.spanner.database.Database.update` methods of instance
object trigger long-running operations on the server, and return instances
of the :class:`~google.cloud.spanner.database.Operation` class.

You can check if a long-running operation has finished
by using its :meth:`~google.cloud.spanner.database.Operation.finished`
method:
conforming to the :class:`~.concurrent.futures.Future` class.

.. code:: python
>>> operation = instance.create()
>>> operation.finished()
True
.. note::
>>> operation.result()
Once an :class:`~google.cloud.spanner.instance.Operation` object
has returned :data:`True` from its
:meth:`~google.cloud.spanner.instance.Operation.finished` method, the
object should not be re-used. Subsequent calls to
:meth:`~google.cloud.spanner.instance.Operation.finished`
will result in an :exc`ValueError` being raised.
Non-Admin Database Usage
========================
Expand Down

0 comments on commit f7947f1

Please sign in to comment.