Skip to content

Commit

Permalink
Enhance verbosity on failed downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
olethanh committed Jan 15, 2025
1 parent bb587e0 commit b860265
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/aleph/vm/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ async def download_file(url: str, local_path: Path) -> None:
await asyncio.wait_for(file_downloaded_by_another_task(local_path), timeout=30)
except TimeoutError as error:
if attempt < (download_attempts - 1):
logger.warning(f"Download failed, retrying attempt {attempt + 1}/{download_attempts}...")
logger.warning(
f"Download failed (waiting for another taks), retrying attempt {attempt + 1}/{download_attempts}..."
)
continue
else:
logger.warning(f"Download of {url} failed (waiting for another task), aborting...")
raise error from file_exists_error
except (
aiohttp.ClientConnectionError,
Expand All @@ -123,6 +126,7 @@ async def download_file(url: str, local_path: Path) -> None:
logger.warning(f"Download failed, retrying attempt {attempt + 1}/{download_attempts}...")
# continue # continue inside try/finally block is unimplemented in `mypyc`
else:
logger.warning(f"Download of {url} failed (aborting...")
raise error
finally:
# Ensure no partial file is left behind
Expand Down

0 comments on commit b860265

Please sign in to comment.