From ba0197fb79b1f6cfafd05d8054fce6f3a0ae9864 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Fri, 22 Sep 2017 21:17:35 -0700 Subject: [PATCH] Provide correct API for monitoring an LRO (database). --- docs/spanner/database-usage.rst | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/docs/spanner/database-usage.rst b/docs/spanner/database-usage.rst index 529010c8443f..8ce25080a1c6 100644 --- a/docs/spanner/database-usage.rst +++ b/docs/spanner/database-usage.rst @@ -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 ========================