Long-Running Operations#
Wrap long-running operations returned from Google Cloud APIs.
-
class
google.cloud.operation.
Operation
(name, client, pb_metadata=None, **kw)[source]# Bases:
object
Representation of a Google API Long-Running Operation.
Parameters: -
complete
# Has the operation already completed?
Return type: bool Returns: True if already completed, else false.
-
classmethod
from_pb
(op_pb, client, **kw)[source]# Factory: construct an instance from a protobuf.
Parameters: - op_pb (
google.longrunning.operations_pb2.Operation
) – Protobuf to be parsed. - client (object: must provide
_operations_stub
accessor.) – The client used to poll for the status of the operation. - kw (dict) – caller-assigned metadata about the operation
Return type: Returns: new instance, with attributes based on the protobuf.
- op_pb (
-
poll
()[source]# Check if the operation has finished.
Return type: bool Returns: A boolean indicating if the current operation has completed. Raises: ValueError
if the operation has already completed.
-
target
= None# Instance assocated with the operations: callers may set.
-