Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to call wandb api once after all threads done on sync_checklist #194

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"5EhvL1FVkQPpMjZX4MAADcW42i3xPSF1KiCpuaxTYVr28sux", # TAO-Validator.com
"5FFApaS75bv5pJHfAp2FVLBj9ZaXuFDjEypsaBNc1wCfe52v", # RoundTable21
"5DvTpiniW9s3APmHRYn8FroUWyfnLtrsid5Mtn5EwMXHN2ed", # FirstTensor
"5HbLYXUBy1snPR8nfioQ7GoA9x76EELzEq9j7F32vWUQHm1x", # Tensorplex
"5E4z3h9yVhmQyCFWNbY9BPpwhx4xFiPwq3eeqmBgVF6KULde", # Tensorplex
"5CXRfP2ekFhe62r7q3vppRajJmGhTi7vwvb2yr79jveZ282w", # Rizzo
"5HNQURvmjjYhTSksi8Wfsw676b4owGwfLR2BFAQzG7H3HhYf", # Neural Inτerneτ
"5DnXm2tBGAD57ySJv5SfpTfLcsQbSKKp6xZKFWABw3cYUgqg", # Love
Expand Down
17 changes: 10 additions & 7 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def __init__(self):
# Initialize penalized_hotkeys as an empty list
self.penalized_hotkeys = []

# Initialize penalized_hotkeys_checklist as an empty list
self.penalized_hotkeys_checklist = []

# Init the thread.
self.lock = threading.Lock()
self.threads: List[threading.Thread] = []
Expand Down Expand Up @@ -358,6 +361,7 @@ def sync_status(self):
self.init_prometheus(force_update=True)

def sync_checklist(self):
self.penalized_hotkeys_checklist = self.wandb.get_penalized_hotkeys_checklist(self.get_valid_validator_hotkeys(), True)
self.threads = []
for i in range(0, len(self.uids), self.validator_challenge_batch_size):
for _uid in self.uids[i : i + self.validator_challenge_batch_size]:
Expand All @@ -379,6 +383,7 @@ def sync_checklist(self):

for thread in self.threads:
thread.join()
self.wandb.update_penalized_hotkeys_checklist(self.penalized_hotkeys_checklist)

def sync_miners_info(self, queryable_tuple_uids_axons: List[Tuple[int, bt.AxonInfo]]):
if queryable_tuple_uids_axons:
Expand Down Expand Up @@ -569,8 +574,7 @@ def execute_miner_checking_request(self, uid, axon: bt.AxonInfo):

if port:
is_port_open = check_port(axon.ip, port)
penalized_hotkeys_checklist = self.wandb.get_penalized_hotkeys_checklist(self.get_valid_validator_hotkeys(), True)
checklist_hotkeys = [item['hotkey'] for item in penalized_hotkeys_checklist]
checklist_hotkeys = [item['hotkey'] for item in self.penalized_hotkeys_checklist]

if is_port_open:
is_ssh_access = True
Expand All @@ -597,14 +601,13 @@ def execute_miner_checking_request(self, uid, axon: bt.AxonInfo):


if axon.hotkey in checklist_hotkeys:
penalized_hotkeys_checklist = [item for item in penalized_hotkeys_checklist if item['hotkey'] != axon.hotkey]
self.penalized_hotkeys_checklist = [item for item in self.penalized_hotkeys_checklist if item['hotkey'] != axon.hotkey]
if not is_ssh_access:
penalized_hotkeys_checklist.append({"hotkey": axon.hotkey, "status_code": "SSH_ACCESS_DISABLED", "description": "It can not access to the server via ssh"})
self.penalized_hotkeys_checklist.append({"hotkey": axon.hotkey, "status_code": "SSH_ACCESS_DISABLED", "description": "It can not access to the server via ssh"})
else:
if axon.hotkey not in checklist_hotkeys:
penalized_hotkeys_checklist.append({"hotkey": axon.hotkey, "status_code": "PORT_CLOSED", "description": "The port of ssh server is closed"})
self.penalized_hotkeys_checklist.append({"hotkey": axon.hotkey, "status_code": "PORT_CLOSED", "description": "The port of ssh server is closed"})

self.wandb.update_penalized_hotkeys_checklist(penalized_hotkeys_checklist)

def execute_specs_request(self):
if len(self.queryable_for_specs) > 0:
Expand Down Expand Up @@ -833,7 +836,7 @@ async def start(self):
# Perform miner checking
if self.current_block % block_next_miner_checking == 0 or block_next_miner_checking < self.current_block:
# Next block the validators will do port checking again.
block_next_miner_checking = self.current_block + 50 # 50 -> every 10 minutes
block_next_miner_checking = self.current_block + 300 # 300 -> every 60 minutes

# Filter axons with stake and ip address.
self._queryable_uids = self.get_queryable()
Expand Down