-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Factor out shared 'Operation' class and helpers. #2165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -74,6 +74,7 @@ | |||
bigtable-row | |||
bigtable-row-filters | |||
bigtable-row-data | |||
operation-api |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Intended to replace the versions currently in '.bigtable.instance' and 'bigtable.cluster'. Differences in approach from those: - No parsing / reconstruction of operation's 'name': the new class just holds the name as retrieved. - Add a 'from_pb' classmethod factory, which attempts to parse out the 'metadata' Any, IFF the 'type_url' on the Any is set, and there is a class registered for it. - Drops the complicated '__eq__'/'__ne__' as YAGNI: if needed, reimplement using just the 'name' attr. Use new 'gcloud.operations.Operation' for long-running ops.
Lost in merge conflict resolution.
Clarify distinction between that method, which makes an API call to test for completion, and the 'complete' property, which stores the last result of that call.
def __init__(self, name, client, metadata=None): | ||
self.name = name | ||
self.client = client | ||
self.metadata = metadata or {} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
LGTM when Travis goes green |
Consider squashing some commits |
I'd rather not squash and have to run through Travis again today. |
Totally |
Also, test that operation_pb.metadta is correctly reflected.
👍 LGTM after latest commit as well. |
Intended to replace the versions currently in
.bigtable.instance
andbigtable.cluster
. Differences in approach from those:name
: the new class just holds the name as retrieved.from_pb
classmethod factory, which attempts to parse out themetadata
Any, IFF thetype_url
on the Any is set, and there is a class registered for it.__eq__
/__ne__
as YAGNI: if needed, reimplement using just thename
attr.Use new
gcloud.operations.Operation
for long-running ops.