Spaces:
Runtime error
Runtime error
rusticluftig
commited on
Commit
•
8114ad7
1
Parent(s):
b204628
Add infinite retries to fetching leaderboard data
Browse files
app.py
CHANGED
@@ -306,24 +306,32 @@ def restart_space():
|
|
306 |
|
307 |
|
308 |
def main():
|
309 |
-
|
|
|
|
|
|
|
|
|
310 |
|
311 |
-
|
312 |
-
|
313 |
|
314 |
-
|
315 |
|
316 |
-
|
317 |
|
318 |
-
|
319 |
-
|
320 |
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
|
|
327 |
|
328 |
demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}")
|
329 |
with demo:
|
|
|
306 |
|
307 |
|
308 |
def main():
|
309 |
+
# To avoid leaderboard failures, infinitely try until we get all data
|
310 |
+
# needed to populate the dashboard
|
311 |
+
while True:
|
312 |
+
try:
|
313 |
+
subtensor, metagraph = get_subtensor_and_metagraph()
|
314 |
|
315 |
+
model_data: List[ModelData] = get_subnet_data(subtensor, metagraph)
|
316 |
+
model_data.sort(key=lambda x: x.incentive, reverse=True)
|
317 |
|
318 |
+
vali_runs = get_wandb_runs(project=VALIDATOR_WANDB_PROJECT, filters={"config.type": "validator", "config.uid": 238})
|
319 |
|
320 |
+
scores = get_scores([x.uid for x in model_data], vali_runs)
|
321 |
|
322 |
+
current_block = metagraph.block.item()
|
323 |
+
next_epoch_block = next_epoch(subtensor, current_block)
|
324 |
|
325 |
+
validator_df = get_validator_weights(metagraph)
|
326 |
+
weight_keys = set()
|
327 |
+
for uid, stats in validator_df.items():
|
328 |
+
weight_keys.update(stats[-1].keys())
|
329 |
+
|
330 |
+
benchmarks, benchmark_timestamp = get_benchmarks()
|
331 |
+
break
|
332 |
+
except Exception as e:
|
333 |
+
print(f"Failed to get data: {e}")
|
334 |
+
time.sleep(30)
|
335 |
|
336 |
demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}")
|
337 |
with demo:
|