Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ca0721

Browse filesBrowse files
Provide correct API for monitoring an LRO (instances). (#4045)
1 parent 03a2efe commit 7ca0721
Copy full SHA for 7ca0721

File tree

Expand file treeCollapse file tree

1 file changed

+6
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-14
lines changed

‎docs/spanner/instance-usage.rst

Copy file name to clipboardExpand all lines: docs/spanner/instance-usage.rst
+6-14Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,32 +141,24 @@ Delete an instance using its
141141
142142
.. _check-on-current-instance-operation:
143143

144-
Check on Current Instance Operation
145-
-----------------------------------
144+
Resolve Current Instance Operation
145+
----------------------------------
146146

147147
The :meth:`~google.cloud.spanner.instance.Instance.create` and
148148
:meth:`~google.cloud.spanner.instance.Instance.update` methods of instance
149149
object trigger long-running operations on the server, and return instances
150150
of the :class:`~google.cloud.spanner.instance.Operation` class.
151151

152-
You can check if a long-running operation has finished
153-
by using its :meth:`~google.cloud.spanner.instance.Operation.finished`
154-
method:
152+
If you want to block on the completion of those operations, use the
153+
``result`` method on the returned objects:
155154

156155
.. code:: python
157156
158157
>>> operation = instance.create()
159-
>>> operation.finished()
160-
True
158+
>>> result = operation.result()
161159
162-
.. note::
160+
This method will raise an exception if the operation fails.
163161

164-
Once an :class:`~google.cloud.spanner.instance.Operation` object
165-
has returned :data:`True` from its
166-
:meth:`~google.cloud.spanner.instance.Operation.finished` method, the
167-
object should not be re-used. Subsequent calls to
168-
:meth:`~google.cloud.spanner.instance.Operation.finished`
169-
will result in an :exc`ValueError` being raised.
170162

171163
Next Step
172164
---------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.