Skip to content

Commit

Permalink
Retry damn ploytope zero grib responses
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed May 29, 2024
1 parent cd9710b commit 2da64f2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions xarray_ecmwf/engine_ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ class DatasetCacher:

@contextlib.contextmanager
def retrieve(
self,
request: dict[str, Any],
override_cache_file: bool | None = None,
tries: int = 2,
) -> Iterator[xr.Dataset]:
for try_ in range(tries):
try:
with self.retrieve_once(request, override_cache_file) as ds:
yield ds
break
except RuntimeError:
LOGGER.exception("Failed retrieve")

@contextlib.contextmanager
def retrieve_once(
self, request: dict[str, Any], override_cache_file: bool | None = None
) -> Iterator[xr.Dataset]:
LOGGER.info(f"retrieving {request}")
Expand Down

0 comments on commit 2da64f2

Please sign in to comment.