Skip to content

Commit

Permalink
Merge pull request #2418 from opentensor/tests/roman/async-unti-tests…
Browse files Browse the repository at this point in the history
…-part-7

[Tests] AsyncSubtensor (Part 7: The final race)
  • Loading branch information
roman-opentensor authored Nov 14, 2024
2 parents fb39a2a + ad9546d commit 6e07d61
Show file tree
Hide file tree
Showing 2 changed files with 525 additions and 14 deletions.
26 changes: 12 additions & 14 deletions bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1403,15 +1403,15 @@ async def register(

async def pow_register(
self: "AsyncSubtensor",
wallet: Wallet,
netuid,
processors,
update_interval,
output_in_place,
verbose,
use_cuda,
dev_id,
threads_per_block,
wallet: "Wallet",
netuid: int,
processors: int,
update_interval: int,
output_in_place: bool,
verbose: bool,
use_cuda: bool,
dev_id: Union[list[int], int],
threads_per_block: int,
):
"""Register neuron."""
return await register_extrinsic(
Expand Down Expand Up @@ -1462,11 +1462,9 @@ async def set_weights(
retries = 0
success = False
message = "No attempt made. Perhaps it is too soon to set weights!"
while (
await self.blocks_since_last_update(netuid, uid)
> await self.weights_rate_limit(netuid)
and retries < max_retries
):
while retries < max_retries and await self.blocks_since_last_update(
netuid, uid
) > await self.weights_rate_limit(netuid):
try:
logging.info(
f"Setting weights for subnet #<blue>{netuid}</blue>. Attempt <blue>{retries + 1} of {max_retries}</blue>."
Expand Down
Loading

0 comments on commit 6e07d61

Please sign in to comment.