This repository was archived by the owner on Dec 31, 2023. It is now read-only.
This repository was archived by the owner on Dec 31, 2023. It is now read-only.
AutoML: add a get_operation_status method to clients #7
Closed
Description
in GoogleCloudPlatform/python-docs-samples#1575 (comment) I noticed one of our samples is relying on an internal method client.transport._operations_client.get_operation(
.
@sirtorry said it is common for training jobs to take long periods of time and having a way of checking on the status is useful.
I believe we should consider exposing a method, perhaps one of the following.
response = client.create_model(project_location, my_model)
response.get_status()
or
operation_name = response.operation.name
client.get_operation_status(operation_name)
It also seems operation.refresh() will do the same thing. Perhaps there is a way to do this currently without adding this functionality?
class Operation(polling.PollingFuture):
"""A Future for interacting with a Google API Long-Running Operation.
Args:
operation (google.longrunning.operations_pb2.Operation): The
initial operation.
refresh (Callable[[], ~.api_core.operation.Operation]): A callable that
returns the latest state of the operation.
cancel (Callable[[], None]): A callable that tries to cancel
the operation.
result_type (func:`type`): The protobuf type for the operation's
result.
metadata_type (func:`type`): The protobuf type for the operation's
metadata.
retry (google.api_core.retry.Retry): The retry configuration used
when polling. This can be used to control how often :meth:`done`
is polled. Regardless of the retry's ``deadline``, it will be
overridden by the ``timeout`` argument to :meth:`result`.
"""