Skip to content

Commit

Permalink
Retry on installing the cloud api resources.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 714941710
  • Loading branch information
Google Earth Engine Authors committed Jan 15, 2025
1 parent 0db413d commit 461296b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/ee/_cloud_api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def build_cloud_resource(
api_key: Optional[str] = None,
credentials: Optional[Any] = None,
timeout: Optional[float] = None,
num_retries: int = 1,
headers_supplier: Optional[Callable[[], Dict[str, Any]]] = None,
response_inspector: Optional[Callable[[Any], None]] = None,
http_transport: Optional[Any] = None,
Expand All @@ -160,6 +161,8 @@ def build_cloud_resource(
api_key: An API key that's enabled for use with the Earth Engine Cloud API.
credentials: OAuth2 credentials to use when authenticating to the API.
timeout: How long a timeout to set on requests, in seconds.
num_retries: The number of times to retry discovery with randomized
exponential backoff, in case of intermittent/connection issues.
headers_supplier: A callable that will return a set of headers to be applied
to a request. Will be called once for each request.
response_inspector: A callable that will be invoked with the raw
Expand Down Expand Up @@ -199,6 +202,7 @@ def build(**kwargs):
requestBuilder=request_builder,
model=alt_model,
cache_discovery=False,
num_retries=num_retries,
**kwargs) # pytype: disable=wrong-keyword-args

resource = None
Expand Down
2 changes: 2 additions & 0 deletions python/ee/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def _install_cloud_api_resource() -> None:
credentials=_credentials,
api_key=_cloud_api_key,
timeout=timeout,
num_retries=_max_retries,
headers_supplier=_make_request_headers,
response_inspector=_handle_profiling_response,
http_transport=_http_transport,
Expand All @@ -338,6 +339,7 @@ def _install_cloud_api_resource() -> None:
credentials=_credentials,
api_key=_cloud_api_key,
timeout=timeout,
num_retries=_max_retries,
headers_supplier=_make_request_headers,
response_inspector=_handle_profiling_response,
http_transport=_http_transport,
Expand Down

0 comments on commit 461296b

Please sign in to comment.