@@ -141,32 +141,24 @@ Delete an instance using its
141
141
142
142
.. _check-on-current-instance-operation :
143
143
144
- Check on Current Instance Operation
145
- -----------------------------------
144
+ Resolve Current Instance Operation
145
+ ----------------------------------
146
146
147
147
The :meth: `~google.cloud.spanner.instance.Instance.create ` and
148
148
:meth: `~google.cloud.spanner.instance.Instance.update ` methods of instance
149
149
object trigger long-running operations on the server, and return instances
150
150
of the :class: `~google.cloud.spanner.instance.Operation ` class.
151
151
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:
155
154
156
155
.. code :: python
157
156
158
157
>> > operation = instance.create()
159
- >> > operation.finished()
160
- True
158
+ >> > result = operation.result()
161
159
162
- .. note ::
160
+ This method will raise an exception if the operation fails.
163
161
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.
170
162
171
163
Next Step
172
164
---------
0 commit comments