AlexNijjar commited on
Commit
7511bc7
·
1 Parent(s): b06d496

Show blacklisted submissions

Browse files
Files changed (2) hide show
  1. src/submissions.py +6 -3
  2. src/wandb_data.py +19 -1
src/submissions.py CHANGED
@@ -3,10 +3,13 @@ import pandas as pd
3
 
4
  from chain_data import sync_metagraph, COMMITMENTS, UIDS_BY_HOTKEY, metagraph
5
  from src import Key
6
- from wandb_data import get_current_runs, Run
7
 
8
 
9
- def get_status(run: Run, hotkey: Key, block: int) -> tuple[str, str]:
 
 
 
10
  if hotkey in run.submissions and block > run.submissions[hotkey].info.block and hotkey not in run.invalid_submissions:
11
  return "Pending", "orange"
12
 
@@ -37,7 +40,7 @@ def create_submissions() -> gr.Dataframe:
37
  ]
38
 
39
  for run in runs:
40
- status, color = get_status(run, hotkey, commitment.block)
41
  row.append(f"<span style='color: {color}'>{status}</span>")
42
 
43
  data.append(row)
 
3
 
4
  from chain_data import sync_metagraph, COMMITMENTS, UIDS_BY_HOTKEY, metagraph
5
  from src import Key
6
+ from wandb_data import get_current_runs, Run, BLACKLISTED_HOTKEYS, BLACKLISTED_COLDKEYS
7
 
8
 
9
+ def get_status(run: Run, hotkey: Key, coldkey: Key, block: int) -> tuple[str, str]:
10
+ if hotkey in BLACKLISTED_HOTKEYS or coldkey in BLACKLISTED_COLDKEYS:
11
+ return "Blacklisted", "gray"
12
+
13
  if hotkey in run.submissions and block > run.submissions[hotkey].info.block and hotkey not in run.invalid_submissions:
14
  return "Pending", "orange"
15
 
 
40
  ]
41
 
42
  for run in runs:
43
+ status, color = get_status(run, hotkey, coldkey, commitment.block)
44
  row.append(f"<span style='color: {color}'>{status}</span>")
45
 
46
  data.append(row)
src/wandb_data.py CHANGED
@@ -3,17 +3,22 @@ from dataclasses import dataclass
3
  from datetime import datetime, timedelta, timezone
4
  from enum import Enum
5
 
 
6
  import wandb
7
  import wandb.apis.public as wapi
8
  from substrateinterface import Keypair
9
 
10
- from src import TIMEZONE, Key
11
  from chain_data import UIDS_BY_HOTKEY, VALIDATOR_IDENTITIES, sync_metagraph
 
12
 
13
  WANDB_RUN_PATH = os.environ["WANDB_RUN_PATH"]
14
 
15
  START_DATE = datetime(2024, 11, 29)
16
 
 
 
 
 
17
 
18
  class BenchmarkStatus(Enum):
19
  NOT_STARTED = ("Not Started", "orange", False)
@@ -258,6 +263,18 @@ def _fetch_current_runs(wandb_api: wandb.Api):
258
  _add_runs(wandb_runs)
259
 
260
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  last_sync: datetime = datetime.fromtimestamp(0, TIMEZONE)
262
 
263
 
@@ -274,6 +291,7 @@ def sync():
274
  _fetch_history(wandb_api)
275
  else:
276
  _fetch_current_runs(wandb_api)
 
277
 
278
 
279
  def get_current_runs() -> list[Run]:
 
3
  from datetime import datetime, timedelta, timezone
4
  from enum import Enum
5
 
6
+ import requests
7
  import wandb
8
  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
 
16
  START_DATE = datetime(2024, 11, 29)
17
 
18
+ BLACKLIST_ENDPOINT = "https://edge-inputs.api.wombo.ai/blacklist"
19
+ BLACKLISTED_COLDKEYS = set()
20
+ BLACKLISTED_HOTKEYS = set()
21
+
22
 
23
  class BenchmarkStatus(Enum):
24
  NOT_STARTED = ("Not Started", "orange", False)
 
263
  _add_runs(wandb_runs)
264
 
265
 
266
+ def _fetch_blacklisted_keys():
267
+ response = requests.get(BLACKLIST_ENDPOINT)
268
+ response.raise_for_status()
269
+ data = response.json()
270
+ BLACKLISTED_COLDKEYS.clear()
271
+ BLACKLISTED_HOTKEYS.clear()
272
+ for hotkey in data["hotkeys"]:
273
+ BLACKLISTED_HOTKEYS.add(hotkey)
274
+ for coldkey in data["coldkeys"]:
275
+ BLACKLISTED_COLDKEYS.add(coldkey)
276
+
277
+
278
  last_sync: datetime = datetime.fromtimestamp(0, TIMEZONE)
279
 
280
 
 
291
  _fetch_history(wandb_api)
292
  else:
293
  _fetch_current_runs(wandb_api)
294
+ _fetch_blacklisted_keys()
295
 
296
 
297
  def get_current_runs() -> list[Run]: