Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 4, 2024
1 parent e7b60e0 commit 54a0b10
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pangeo_forge_recipes/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,19 @@ def transfer_file(self, index: int, url: str) -> Tuple[int, str]:
while retries <= self.max_retries:
try:
open_kwargs = self.open_kwargs or {}
self.transfer_target.cache_file(url, self.secrets, self.fsspec_sync_patch, **open_kwargs)
self.transfer_target.cache_file(
url, self.secrets, self.fsspec_sync_patch, **open_kwargs
)
return (index, self.transfer_target._full_path(url))
except Exception as e:
if retries == self.max_retries:
logger.error(f"Max retries reached for {url}: {e}")
raise e
else:
backoff_time = self.initial_backoff * (self.backoff_factor ** retries)
logger.warning(f"Error transferring file {url}: {e}. Retrying in {backoff_time} seconds...")
backoff_time = self.initial_backoff * (self.backoff_factor**retries)
logger.warning(
f"Error transferring file {url}: {e}. Retrying in {backoff_time} seconds..."
)
time.sleep(backoff_time)
retries += 1

Expand Down Expand Up @@ -255,7 +259,7 @@ def expand(self, pcoll):
fsspec_sync_patch=self.fsspec_sync_patch,
max_retries=self.max_retries,
initial_backoff=self.initial_backoff,
backoff_factor=self.backoff_factor
backoff_factor=self.backoff_factor,
)
)
)
Expand Down

0 comments on commit 54a0b10

Please sign in to comment.