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

feat: add retry/timeout to manual surface #222

Merged
merged 41 commits into from Oct 21, 2020
Merged

feat: add retry/timeout to manual surface #222

merged 41 commits into from Oct 21, 2020

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Oct 13, 2020

Base Classes

  • base_client.BaseClient.collections (signature only)
  • base_client.BaseClient.get_all (signature only)
  • base_collection.BaseCollectionReference.add (signature only)
  • base_collection.BaseCollectionReference.get (signature only)
  • base_collection.BaseCollectionReference.list_documents (signature only)
  • base_collection.BaseCollectionReference.stream (signature only)
  • base_document.BaseDocumentReference.collections (signature only)
  • base_document.BaseDocumentReference.create (signature only)
  • base_document.BaseDocumentReference.delete (signature only)
  • base_document.BaseDocumentReference.get (signature only)
  • base_document.BaseDocumentReference.set (signature only)
  • base_document.BaseDocumentReference.update (signature only)
  • base_query.BaseCollectionGroup.get_partitions (signature only)
  • base_query.BaseQuery.get (signature only)
  • base_query.BaseQuery.stream (signature only)
  • base_transaction.BaseTransaction.get (signature only)
  • base_transaction.BaseTransaction.get_all (signature only)

Synchronous

  • batch.Batch.commit
  • client.Client.collections
  • client.Client.get_all
  • collection.Collection.add
  • collection.Collection.get
  • collection.Collection.list_documents
  • collection.Collection.stream
  • document.Document.collections
  • document.Document.create
  • document.Document.delete
  • document.Document.get
  • document.Document.set
  • document.Document.update
  • query.CollectionGroup.get_partitions
  • query.Query.get
  • query.Query.stream
  • transaction.Transaction.get
  • transaction.Transaction.get_all

Asynchronous

  • async_batch.AsyncBatch.commit
  • async_client.AsyncClient.collections
  • async_client.AsyncClient.get_all
  • async_collection.AsyncCollection.add
  • async_collection.AsyncCollection.get
  • async_collection.AsyncCollection.list_documents
  • async_collection.AsyncCollection.stream
  • async_document.AsyncDocument.collections
  • async_document.AsyncDocument.create
  • async_document.AsyncDocument.delete
  • async_document.AsyncDocument.get
  • async_document.AsyncDocument.set
  • async_document.AsyncDocument.update
  • async_query.AsyncCollectionGroup.get_partitions
  • async_query.AsyncQuery.get
  • async_query.AsyncQuery.stream
  • async_transaction.AsyncTransaction.get
  • async_transaction.AsyncTransaction.get_all

Unsure

  • base_collection.BaseCollection.on_snapshot (signature only)
  • base_document.BaseDocumentRef.on_snapshot (signature only)
  • base_query.BaseQuery.on_snapshot (signature only)
  • collection.Collection.on_snapshot
  • document.Document.on_snapshot
  • query.Query.on_snapshot
  • watch.Watch.__init__
  • watch.Watch.for_document
  • watch.Watch.for_query

Closes #221

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 13, 2020
Methods include:

- 'create'
- 'set'
- 'update'
- 'delete'
- 'get'
- 'collections'

Toward #221
@tseaver tseaver marked this pull request as ready for review October 14, 2020 20:12
@tseaver tseaver requested review from a team and chrisrossi October 14, 2020 20:12
@tseaver
Copy link
Contributor Author

tseaver commented Oct 14, 2020

Note to reviewers: commit-by-commit is likely the most fruitful approach.

Updated: I just reviewed it as a whole, and think it is easier than following the commit-by-commit path.

Copy link
Contributor Author

@tseaver tseaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on commit-by-commit review reflecting later changes as the PR evolved.

if timeout is not None:
kwargs["timeout"] = timeout

return kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later commits factor this method out into _helpers.make_retry_timeout_kwargs.

retry=retry,
timeout=timeout,
metadata=client._rpc_metadata,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

40fae96 removes most of the redundancy in the tests for Client.get_all.

timeout=timeout,
metadata=client._rpc_metadata,
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad75e1 factors out the redundancy in the tests for Client.collections.

kwargs["retry"] = retry

if timeout is not None:
kwargs["timeout"] = timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since factored out to use _helpers.make_retry_timeout_kwargs.

kwargs["retry"] = retry

if timeout is not None:
kwargs["timeout"] = timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, later commits update to use the helper here.

kwargs["retry"] = retry

if timeout is not None:
kwargs["timeout"] = timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out later to use the helper.

kwargs["retry"] = retry

if timeout is not None:
kwargs["timeout"] = timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out later to use the helper.

kwargs["retry"] = retry

if timeout is not None:
kwargs["timeout"] = timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out later to use the helper.

)

while True:
for i in iterator.collection_ids:
yield self.collection(i)
if iterator.next_page_token:
next_request = request.cpoy()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo fixed in 9b4707a

)

while True:
for i in iterator.collection_ids:
yield self.collection(i)
if iterator.next_page_token:
next_request = request.cpoy()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo fixed in 1acbde3

google/cloud/firestore_v1/query.py Show resolved Hide resolved
iterator = _Iterator(pages=[collection_ids])
firestore_api.list_collection_ids.return_value = iterator

collections = [c async for c in client.collections()]
collections = [c async for c in client.collections(**kwargs)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirming, you have added these changes to a few tests to get complete coverage? The changes of this PR shouldn't result in any required changes to users correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. See test_collections and test_collections_w_retry_timeout below.

@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 21, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 21, 2020
@tseaver tseaver merged commit db5f286 into master Oct 21, 2020
@tseaver tseaver deleted the 221-retry-timeout branch October 21, 2020 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose retry, timeout parameters in manual surface
3 participants