Commit
·
3d139b5
1
Parent(s):
4c7c0d6
5 retries max
Browse files- src/leaderboard/populate.py +10 -8
src/leaderboard/populate.py
CHANGED
|
@@ -16,7 +16,7 @@ def download_result_data():
|
|
| 16 |
os.environ["HF_HUB_ETAG_TIMEOUT"] = "30"
|
| 17 |
os.environ["HF_HUB_DOWNLOAD_TIMEOUT"] = "30"
|
| 18 |
|
| 19 |
-
|
| 20 |
try:
|
| 21 |
snapshot_download(
|
| 22 |
repo_id=RESULTS_REPO_ID,
|
|
@@ -27,14 +27,16 @@ def download_result_data():
|
|
| 27 |
token=TOKEN,
|
| 28 |
allow_patterns=["results/*"],
|
| 29 |
)
|
| 30 |
-
|
| 31 |
except Exception as e:
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
def load_results() -> pd.DataFrame:
|
|
|
|
| 16 |
os.environ["HF_HUB_ETAG_TIMEOUT"] = "30"
|
| 17 |
os.environ["HF_HUB_DOWNLOAD_TIMEOUT"] = "30"
|
| 18 |
|
| 19 |
+
for i in range(5):
|
| 20 |
try:
|
| 21 |
snapshot_download(
|
| 22 |
repo_id=RESULTS_REPO_ID,
|
|
|
|
| 27 |
token=TOKEN,
|
| 28 |
allow_patterns=["results/*"],
|
| 29 |
)
|
| 30 |
+
return
|
| 31 |
except Exception as e:
|
| 32 |
+
print(f"Connection error: {e.__class__.__name__} {e}. Retrying in {3 * (i + 1)} seconds...")
|
| 33 |
+
time.sleep(3 * (i + 1))
|
| 34 |
+
continue
|
| 35 |
+
|
| 36 |
+
raise RuntimeError(
|
| 37 |
+
f"Failed to download {RESULTS_REPO_ID} after 5 attempts. "
|
| 38 |
+
"Please check your internet connection or the repository."
|
| 39 |
+
)
|
| 40 |
|
| 41 |
|
| 42 |
def load_results() -> pd.DataFrame:
|