Skip to content

Commit

Permalink
- refactor of setting subnet weights
Browse files Browse the repository at this point in the history
  • Loading branch information
Snedashkovsky committed Feb 15, 2024
1 parent fac0f6e commit 80c0460
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions cybertensor/messages/set_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,42 +86,11 @@ def set_weights_message(
with console.status(
f":satellite: Setting weights on [white]{cwtensor.network}[/white] ..."
):
try:
success, error_message = cwtensor._do_set_weights(
return cwtensor._do_set_weights(
wallet=wallet,
netuid=netuid,
uids=weight_uids,
vals=weight_vals,
version_key=version_key,
wait_for_finalization=wait_for_finalization,
)

if not wait_for_finalization:
return True

if success is True:
console.print(
":white_heavy_check_mark: [green]Finalized[/green]"
)
cybertensor.logging.success(
prefix="Set weights",
sufix=f"<green>Finalized: </green>{success}",
)
return True
else:
console.print(
f":cross_mark: [red]Failed[/red]: error:{error_message}",
)
cybertensor.logging.warning(
prefix="Set weights",
sufix=f"<red>Failed: </red>{error_message}",
)
return False

except Exception as e:
# TODO( devs ): lets remove all of the cybertensor.__console__ calls and replace with loguru.
console.print(f":cross_mark: [red]Failed[/red]: error:{e}")
cybertensor.logging.warning(
prefix="Set weights", sufix=f"<red>Failed: </red>{e}"
)
return False

0 comments on commit 80c0460

Please sign in to comment.