resources: Catch ConnectionResourceError in downloading resources
This handles an error we see within GitHub Actions that occassionally occurs when downloading resources. We retry in the same way we do when handling HTTPErrors. Change-Id: I4dce5d607ccc41ad53b51e39082c486e644d815c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71858 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -139,6 +139,22 @@ def _download(url: str, download_to: str, max_attempts: int = 6) -> None:
|
||||
time.sleep((2**attempt) + random.uniform(0, 1))
|
||||
else:
|
||||
raise e
|
||||
except ConnectionResetError as e:
|
||||
# This catches the ConnectionResetError we see occassionally see
|
||||
# when accessing resources on GitHub Actions. It retries using a
|
||||
# Truncated Exponential backoff algorithm, truncating after
|
||||
# "max_attempts". If any other is retrieved we raise the error.
|
||||
if e.errno == 104:
|
||||
attempt += 1
|
||||
if attempt >= max_attempts:
|
||||
raise Exception(
|
||||
f"After {attempt} attempts, the resource json could "
|
||||
"not be retrieved. OS Error Code retrieved: "
|
||||
f"{e.errno}"
|
||||
)
|
||||
time.sleep((2**attempt) + random.uniform(0, 1))
|
||||
else:
|
||||
raise e
|
||||
except ValueError as e:
|
||||
raise Exception(
|
||||
"Environment variable GEM5_USE_PROXY is set to "
|
||||
|
||||
Reference in New Issue
Block a user