Skip to content

Commit

Permalink
now updates current block on calls to set_weights
Browse files Browse the repository at this point in the history
  • Loading branch information
hayden-yuma committed Dec 6, 2024
1 parent 4a4cb8c commit ed937b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion precog/validators/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, config=None, loop=None):
self.prediction_interval = self.config.prediction_interval # in minutes
self.N_TIMEPOINTS = self.config.N_TIMEPOINTS # number of timepoints to predict
self.last_sync = 0
self.set_weights_rate = 150 # in blocks
self.set_weights_rate = 100 # in blocks
self.resync_metagraph_rate = 600 # in seconds
bt.logging.info(
f"Running validator for subnet: {self.config.netuid} on network: {self.config.subtensor.network}"
Expand All @@ -41,6 +41,7 @@ def __init__(self, config=None, loop=None):
self.save_state()
else:
self.load_state()
self.current_block = self.subtensor.get_current_block()
self.blocks_since_last_update = self.subtensor.blocks_since_last_update(
netuid=self.config.netuid, uid=self.my_uid
)
Expand Down Expand Up @@ -118,6 +119,7 @@ async def set_weights(self):
self.blocks_since_last_update = self.subtensor.blocks_since_last_update(
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")
if self.blocks_since_last_update >= self.set_weights_rate:
Expand Down

0 comments on commit ed937b4

Please sign in to comment.