Skip to content

Commit

Permalink
resets blocks_since_last_update on successful set weights
Browse files Browse the repository at this point in the history
  • Loading branch information
hscott-yuma committed Dec 6, 2024
1 parent ed937b4 commit 9573841
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions precog/validators/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ async def set_weights(self):
netuid=self.config.netuid, uid=self.my_uid
)
self.current_block = self.subtensor.get_current_block()
except Exception:
bt.logging.error("Failed to get current block, skipping block update")
except Exception as e:
bt.logging.error(f"Failed to get current block with error {e}, skipping block update")
if self.blocks_since_last_update >= self.set_weights_rate:
uids = array(self.available_uids)
weights = [self.moving_average_scores[uid] for uid in self.available_uids]
Expand All @@ -145,6 +145,7 @@ async def set_weights(self):
)
if result:
bt.logging.success("✅ Set Weights on chain successfully!")
self.blocks_since_last_update = 0
else:
bt.logging.debug(
"Failed to set weights this iteration with message:",
Expand Down

0 comments on commit 9573841

Please sign in to comment.