Skip to content
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

Factor out shared 'Operation' class and helpers. #2165

Merged
merged 9 commits into from
Aug 24, 2016
Merged

Factor out shared 'Operation' class and helpers. #2165

merged 9 commits into from
Aug 24, 2016

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Aug 22, 2016

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.

@tseaver tseaver added api: core api: bigtable Issues related to the Bigtable API. labels Aug 22, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 22, 2016
@@ -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.

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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Aug 23, 2016

LGTM when Travis goes green

@dhermes
Copy link
Contributor

dhermes commented Aug 23, 2016

Consider squashing some commits

@tseaver
Copy link
Contributor Author

tseaver commented Aug 23, 2016

I'd rather not squash and have to run through Travis again today.

@dhermes
Copy link
Contributor

dhermes commented Aug 23, 2016

Totally

Also, test that operation_pb.metadta is correctly reflected.
@dhermes
Copy link
Contributor

dhermes commented Aug 23, 2016

👍 LGTM after latest commit as well.

@tseaver tseaver merged commit e63b1d8 into googleapis:master Aug 24, 2016
@tseaver tseaver deleted the factor-out-operations branch August 24, 2016 14:34
@dhermes dhermes mentioned this pull request Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API. api: core cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants