Skip to content

Conversation

@theacodes
Copy link
Contributor

Note: This adds a dependency on the tenacity library. It's worth it.

Towards #3617

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 17, 2017
Args:
operation (dict): Operation as a dictionary.
api_request (Callable): A callable used to make an API request. This

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@lukesneeringer lukesneeringer left a comment

Choose a reason for hiding this comment

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

This seems fine to me. No issues adding tenacity.

Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

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

High-level: Do LRO RPC services give trailers describing when to retry?

'google-auth >= 0.4.0, < 2.0.0dev',
'google-auth-httplib2',
'six',
'tenacity >= 4.0.0, <5.0.0dev'

This comment was marked as spam.

This comment was marked as spam.

"""Abstract and helper bases for Future implementations."""

import abc
import concurrent.futures

This comment was marked as spam.

This comment was marked as spam.

The private :meth:`_blocking_poll` method should be implemented by
subclasses.
The private :meth:`done` method should be implemented by

This comment was marked as spam.

This comment was marked as spam.

"""
# pylint: disable=missing-raises
raise NotImplementedError()
if self._result_set:

This comment was marked as spam.

This comment was marked as spam.

if self._result_set:
return

retry_on = tenacity.retry_if_result(lambda result: result is not True)

This comment was marked as spam.

This comment was marked as spam.

self.set_exception(exception)
else:
exception = exceptions.GoogleCloudError(
'Unknown operation error')

This comment was marked as spam.

This comment was marked as spam.

bool: True if the operation is complete, False otherwise.
"""
operation = self._refresh_and_update()
return operation.done

This comment was marked as spam.

This comment was marked as spam.

Args:
operation (dict): Operation as a dictionary.
api_request (Callable): A callable used to make an API request. This

This comment was marked as spam.

Args:
operation (dict): Operation as a dictionary.
api_request (Callable): A callable used to make an API request. This
should generally be an instance of

This comment was marked as spam.

This comment was marked as spam.

to a given API) vis `HTTP/JSON`_.
.. _HTTP/JSON: https://cloud.google.com/speech/reference/rest/\
v1beta1/operations#Operation

This comment was marked as spam.

This comment was marked as spam.

exception = exceptions.GoogleCloudError(
'Unknown operation error')
'Unexpected state: Long-running operation had neither '
'response nor error set.')

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

@dhermes the latest release of resumable-media seems to have broken circle. Do you want me to hold off on merging this until you can resolve that? (Master will be broken by it either way).

@theacodes
Copy link
Contributor Author

Rebased and waiting on CI to merge.

@theacodes theacodes merged commit c565801 into googleapis:master Jul 19, 2017
@theacodes theacodes deleted the future branch July 19, 2017 16:41
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
parthea pushed a commit that referenced this pull request Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants