AlexNijjar commited on
Commit
d06906e
β€’
1 Parent(s): 066f48d

Better validator checking

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -23,9 +23,6 @@ subtensor = bt.subtensor()
23
  metagraph = bt.metagraph(netuid=NET_UID)
24
  bt.logging.disable_logging()
25
 
26
- runs: dict[int, list[Run]] = {}
27
- validator_identities: dict[int, str] = {}
28
-
29
  wandb_api = wandb.Api()
30
  demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}", fill_height=True, fill_width=True)
31
 
@@ -57,6 +54,7 @@ class State:
57
 
58
 
59
  data: dict[int, State] = {}
 
60
 
61
 
62
  def is_valid_run(run: Run):
@@ -91,6 +89,10 @@ def fetch_wandb_data():
91
  if not is_valid_run(run):
92
  continue
93
 
 
 
 
 
94
  submissions: set[int] = set()
95
  benchmarks: set[int] = set()
96
  invalid: list[int] = []
@@ -115,15 +117,13 @@ def fetch_wandb_data():
115
  for benchmark_key, benchmark_value in value.items():
116
  benchmarks.add(int(benchmark_key))
117
 
118
- source_validator_uid = run.config["uid"]
119
-
120
  status = Status.IN_PROGRESS
121
  if completed:
122
  status = Status.DONE
123
  elif not submissions or (not average_benchmark_time and benchmarks):
124
  status = Status.BROKEN
125
 
126
- data[source_validator_uid] = State(
127
  status=status,
128
  hotkey=run.config["hotkey"],
129
  version=run.tags[1][8:],
@@ -138,7 +138,7 @@ def fetch_wandb_data():
138
 
139
  def fetch_identities():
140
  validator_identities.clear()
141
- for uid in range(metagraph.n.item()):
142
  identity = subtensor.substrate.query('SubtensorModule', 'Identities', [metagraph.coldkeys[uid]])
143
  if identity != None:
144
  validator_identities[uid] = identity.value["name"]
 
23
  metagraph = bt.metagraph(netuid=NET_UID)
24
  bt.logging.disable_logging()
25
 
 
 
 
26
  wandb_api = wandb.Api()
27
  demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}", fill_height=True, fill_width=True)
28
 
 
54
 
55
 
56
  data: dict[int, State] = {}
57
+ validator_identities: dict[int, str] = {}
58
 
59
 
60
  def is_valid_run(run: Run):
 
89
  if not is_valid_run(run):
90
  continue
91
 
92
+ uid = run.config["uid"]
93
+ if not metagraph.validator_permit[uid]:
94
+ continue
95
+
96
  submissions: set[int] = set()
97
  benchmarks: set[int] = set()
98
  invalid: list[int] = []
 
117
  for benchmark_key, benchmark_value in value.items():
118
  benchmarks.add(int(benchmark_key))
119
 
 
 
120
  status = Status.IN_PROGRESS
121
  if completed:
122
  status = Status.DONE
123
  elif not submissions or (not average_benchmark_time and benchmarks):
124
  status = Status.BROKEN
125
 
126
+ data[uid] = State(
127
  status=status,
128
  hotkey=run.config["hotkey"],
129
  version=run.tags[1][8:],
 
138
 
139
  def fetch_identities():
140
  validator_identities.clear()
141
+ for uid in data.keys():
142
  identity = subtensor.substrate.query('SubtensorModule', 'Identities', [metagraph.coldkeys[uid]])
143
  if identity != None:
144
  validator_identities[uid] = identity.value["name"]