AlexNijjar commited on
Commit
78f61d6
·
1 Parent(s): 94d9564

Include revision

Browse files
Files changed (3) hide show
  1. src/chain_data.py +3 -2
  2. src/submissions.py +3 -3
  3. src/wandb_data.py +2 -1
src/chain_data.py CHANGED
@@ -9,6 +9,7 @@ from fiber.chain.commitments import _deserialize_commitment_field
9
  from fiber.chain.interface import get_substrate
10
  from fiber.chain.metagraph import Metagraph
11
  from fiber.chain.models import Node
 
12
  from substrateinterface.storage import StorageKey
13
 
14
  from network_commitments import Decoder
@@ -63,7 +64,7 @@ UIDS_BY_HOTKEY: dict[Key, Uid] = {}
63
  HOTKEYS_BY_UID: dict[Uid, Key] = {}
64
 
65
  substrate = get_substrate()
66
- metagraph = Metagraph(substrate, netuid=NET_UID, load_old_nodes=False)
67
 
68
 
69
  def query_subtensor(storage_keys: list[StorageKey], block: int) -> list:
@@ -214,4 +215,4 @@ def sync_metagraph():
214
  fetch_commitments(block)
215
  except Exception as e:
216
  print(f"Error occurred while syncing metagraph: {e}")
217
- substrate = get_substrate(subtensor_address=substrate.url)
 
9
  from fiber.chain.interface import get_substrate
10
  from fiber.chain.metagraph import Metagraph
11
  from fiber.chain.models import Node
12
+ from substrateinterface import SubstrateInterface
13
  from substrateinterface.storage import StorageKey
14
 
15
  from network_commitments import Decoder
 
64
  HOTKEYS_BY_UID: dict[Uid, Key] = {}
65
 
66
  substrate = get_substrate()
67
+ metagraph = Metagraph(substrate, netuid=str(NET_UID), load_old_nodes=False)
68
 
69
 
70
  def query_subtensor(storage_keys: list[StorageKey], block: int) -> list:
 
215
  fetch_commitments(block)
216
  except Exception as e:
217
  print(f"Error occurred while syncing metagraph: {e}")
218
+ substrate = SubstrateInterface(substrate.url)
src/submissions.py CHANGED
@@ -16,12 +16,12 @@ class SubmissionStatus(Enum):
16
  INVALID = ("Invalid", "red")
17
 
18
  @staticmethod
19
- def get_status(run: Run, hotkey: Key, coldkey: Key, block: int) -> "SubmissionStatus":
20
  if hotkey in BLACKLISTED_HOTKEYS or coldkey in BLACKLISTED_COLDKEYS:
21
  return SubmissionStatus.BLACKLISTED
22
 
23
  if any(
24
- submission.hotkey == hotkey
25
  for submission in DUPLICATE_SUBMISSIONS
26
  ):
27
  return SubmissionStatus.DUPLICATE
@@ -61,7 +61,7 @@ def create_submissions(submission_filters: list[str]) -> gr.Dataframe:
61
 
62
  has_data = False
63
  for run in runs:
64
- status = SubmissionStatus.get_status(run, hotkey, coldkey, commitment.block)
65
  if status.value[0] in submission_filters:
66
  row.append(f"<span style='color: {status.value[1]}'>{status.value[0]}</span>")
67
  has_data = True
 
16
  INVALID = ("Invalid", "red")
17
 
18
  @staticmethod
19
+ def get_status(run: Run, hotkey: Key, coldkey: Key, block: int, revision: str) -> "SubmissionStatus":
20
  if hotkey in BLACKLISTED_HOTKEYS or coldkey in BLACKLISTED_COLDKEYS:
21
  return SubmissionStatus.BLACKLISTED
22
 
23
  if any(
24
+ submission.hotkey == hotkey and submission.revision == revision
25
  for submission in DUPLICATE_SUBMISSIONS
26
  ):
27
  return SubmissionStatus.DUPLICATE
 
61
 
62
  has_data = False
63
  for run in runs:
64
+ status = SubmissionStatus.get_status(run, hotkey, coldkey, commitment.block, commitment.revision)
65
  if status.value[0] in submission_filters:
66
  row.append(f"<span style='color: {status.value[1]}'>{status.value[0]}</span>")
67
  has_data = True
src/wandb_data.py CHANGED
@@ -24,8 +24,9 @@ BLACKLISTED_HOTKEYS = set()
24
 
25
  class DuplicateSubmission(BaseModel):
26
  hotkey: Key
27
- copy_of: Key
28
  url: str
 
 
29
 
30
  DUPLICATE_SUBMISSIONS: list[DuplicateSubmission] = []
31
 
 
24
 
25
  class DuplicateSubmission(BaseModel):
26
  hotkey: Key
 
27
  url: str
28
+ revision: str
29
+ copy_of: Key
30
 
31
  DUPLICATE_SUBMISSIONS: list[DuplicateSubmission] = []
32