Spaces:
Running
Running
Commit
·
546fcbe
1
Parent(s):
c36279d
Fix dereged validators crashing dashboard
Browse files- src/validator_states.py +3 -1
- src/validator_weights.py +3 -1
- src/wandb_data.py +15 -2
src/validator_states.py
CHANGED
@@ -34,7 +34,9 @@ def create_validator_states() -> gr.Dataframe:
|
|
34 |
winner_uid_mode = statistics.mode(winners) if winners else None
|
35 |
latest_version = get_latest_version(runs)
|
36 |
for run in runs:
|
37 |
-
|
|
|
|
|
38 |
updated = UPDATED.get(run.hotkey, 0)
|
39 |
data.append([
|
40 |
run.uid,
|
|
|
34 |
winner_uid_mode = statistics.mode(winners) if winners else None
|
35 |
latest_version = get_latest_version(runs)
|
36 |
for run in runs:
|
37 |
+
if not run.hotkey in get_nodes():
|
38 |
+
continue
|
39 |
+
vtrust = get_nodes()[run.hotkey].vtrust
|
40 |
updated = UPDATED.get(run.hotkey, 0)
|
41 |
data.append([
|
42 |
run.uid,
|
src/validator_weights.py
CHANGED
@@ -56,7 +56,9 @@ def create_weights(include_inactive: bool) -> gr.Dataframe:
|
|
56 |
datatype.append("markdown")
|
57 |
|
58 |
for hotkey, validator_weights in weights.items():
|
59 |
-
|
|
|
|
|
60 |
row = [UIDS_BY_HOTKEY[hotkey], f"<span style='color: {get_color_by_weight(incentive)}'>{incentive:.{3}f}</span>"]
|
61 |
for _, weight in validator_weights:
|
62 |
row.append(f"<span style='color: {get_color_by_weight(weight)}'>{weight:.{3}f}</span>")
|
|
|
56 |
datatype.append("markdown")
|
57 |
|
58 |
for hotkey, validator_weights in weights.items():
|
59 |
+
if not hotkey in get_nodes():
|
60 |
+
continue
|
61 |
+
incentive = get_nodes()[hotkey].incentive / 2 ** 16
|
62 |
row = [UIDS_BY_HOTKEY[hotkey], f"<span style='color: {get_color_by_weight(incentive)}'>{incentive:.{3}f}</span>"]
|
63 |
for _, weight in validator_weights:
|
64 |
row.append(f"<span style='color: {get_color_by_weight(weight)}'>{weight:.{3}f}</span>")
|
src/wandb_data.py
CHANGED
@@ -9,7 +9,7 @@ import wandb.apis.public as wapi
|
|
9 |
from substrateinterface import Keypair
|
10 |
|
11 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
12 |
-
from src import TIMEZONE, Key
|
13 |
|
14 |
WANDB_RUN_PATH = os.environ["WANDB_RUN_PATH"]
|
15 |
|
@@ -306,5 +306,18 @@ def get_current_runs() -> list[Run]:
|
|
306 |
for run in runs:
|
307 |
if run.start_date >= today:
|
308 |
current_runs.append(run)
|
309 |
-
|
310 |
return current_runs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
from substrateinterface import Keypair
|
10 |
|
11 |
from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
|
12 |
+
from src import TIMEZONE, Key, Uid
|
13 |
|
14 |
WANDB_RUN_PATH = os.environ["WANDB_RUN_PATH"]
|
15 |
|
|
|
306 |
for run in runs:
|
307 |
if run.start_date >= today:
|
308 |
current_runs.append(run)
|
309 |
+
print_results_json(current_runs)
|
310 |
return current_runs
|
311 |
+
|
312 |
+
def print_results_json(runs: list[Run]):
|
313 |
+
validators_to_scores: dict[Uid, dict[Key, str]] = {}
|
314 |
+
for run in runs:
|
315 |
+
scores: dict[Key, str] = {}
|
316 |
+
for hotkey, submission in run.submissions.items():
|
317 |
+
scores[hotkey] = f"({submission.score}, {submission.info.block})"
|
318 |
+
|
319 |
+
validators_to_scores[run.uid] = scores
|
320 |
+
|
321 |
+
validators_to_scores = dict(sorted(validators_to_scores.items(), key=lambda item: item[0]))
|
322 |
+
from json import dumps
|
323 |
+
print(dumps(validators_to_scores, indent=4))
|