Spaces:
Runtime error
Runtime error
rusticluftig
commited on
Commit
·
779bad9
1
Parent(s):
479d13f
Add retries to loading runs from wandb
Browse files
app.py
CHANGED
|
@@ -158,14 +158,21 @@ def is_floatable(x) -> bool:
|
|
| 158 |
def get_scores(
|
| 159 |
uids: List[int],
|
| 160 |
) -> Dict[int, Dict[str, Optional[float]]]:
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
api.
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
| 166 |
)
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
result = {}
|
| 170 |
previous_timestamp = None
|
| 171 |
# Iterate through the runs until we've processed all the uids.
|
|
|
|
| 158 |
def get_scores(
|
| 159 |
uids: List[int],
|
| 160 |
) -> Dict[int, Dict[str, Optional[float]]]:
|
| 161 |
+
runs = []
|
| 162 |
+
while True:
|
| 163 |
+
api = wandb.Api(api_key=WANDB_TOKEN)
|
| 164 |
+
runs = list(
|
| 165 |
+
api.runs(
|
| 166 |
+
VALIDATOR_WANDB_PROJECT,
|
| 167 |
+
filters={"config.type": "validator", "config.uid": 238},
|
| 168 |
+
)
|
| 169 |
)
|
| 170 |
+
if len(runs) > 0:
|
| 171 |
+
break
|
| 172 |
+
# WandDB API is quite unreliable. Wait another minute and try again.
|
| 173 |
+
print("Failed to get runs from Wandb. Trying again in 60 seconds.")
|
| 174 |
+
time.sleep(60)
|
| 175 |
+
|
| 176 |
result = {}
|
| 177 |
previous_timestamp = None
|
| 178 |
# Iterate through the runs until we've processed all the uids.
|