-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add self-commands request to server #5
Conversation
src/bt_auto_dumper/_v2/__main__.py
Outdated
CODENAME_MAP = { | ||
"computehorde": ["sn12", "12", "computehorde"], | ||
"omron": ["sn13", "13", "omron", "Omron"], | ||
"textprompting": ["sn14", "14", "textprompting"], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has to be retrieved from the autovalidator, should not be hardcoded here
src/bt_auto_dumper/_v2/__main__.py
Outdated
@@ -57,49 +71,46 @@ def main(apiver: str | None = None): | |||
|
|||
if not (subnet_identifier := args.subnet_identifier) or not (autovalidator_address := args.autovalidator_address): | |||
autovalidator_address, subnet_identifier = load_config(config_path=config_path) | |||
dump_and_upload(subnet_identifier, args.subnet_realm, autovalidator_address, args.note) | |||
filtered_subnet_identifier = re.sub(r"[_\-.]", "", str.lower(subnet_identifier)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this line to normalize_codename()
src/bt_auto_dumper/_v2/__main__.py
Outdated
@@ -250,5 +263,37 @@ def update_confg(config_path: str, new_autovalidator_address: str, new_codename: | |||
raise RuntimeError(f"Failed to write to the configuration file: {config_path}.\n Error: {e}") | |||
|
|||
|
|||
def request_commands_to_server( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def request_commands_to_server( | |
def request_commands_from_server( |
src/bt_auto_dumper/_v2/__main__.py
Outdated
logger.info(f"Subnet dumper commands of {subnet_identifier} retrieved successfully. {commands}") | ||
if not commands: | ||
print(f"Subnet identifier {subnet_identifier} not found.") | ||
logger.error(f"Subnet dumper commands of {subnet_identifier} not found.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there are no commands, both of those logs will be emitted
src/bt_auto_dumper/_v2/__main__.py
Outdated
@@ -277,46 +283,13 @@ def get_commands_from_server( | |||
response = make_signed_request("GET", url, headers, "", wallet, subnet_realm) | |||
if response.status_code == 200: | |||
data = response.json() | |||
print(data) | |||
print("Commands successfully retrieved.") | |||
logger.info("Commands successfully retrieved.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info("Commands successfully retrieved.") |
this duplicates a log statement from main.py line 106
src/bt_auto_dumper/_v2/__main__.py
Outdated
commands = get_commands_from_server(subnet_identifier, subnet_realm, wallet, autovalidator_address) | ||
|
||
# get normalized subnet identifier and commands from the central server | ||
subnet_identifier, commands = get_commands_from_server( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to docstring and return type of get_commands_from_server()
, the function only returns commands and does not return a subnet identifier
src/bt_auto_dumper/_v2/__main__.py
Outdated
|
||
args = parser.parse_args() | ||
|
||
# Get configuration directory from env variable. | ||
config_base_dir = os.getenv("CONFIG_DIR") | ||
config_base_dir = os.getenv("CONFIG_DIR", default="") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config_base_dir = os.getenv("CONFIG_DIR", default="") | |
config_base_dir = os.getenv("CONFIG_DIR", default=`~/.config/bt-auto-dumper`) |
src/bt_auto_dumper/_v2/__main__.py
Outdated
|
||
wallet = bt.wallet(name="validator", hotkey="validator-hotkey", path="~/.bittensor/wallets") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should all be taken from the config, but should have defaults
src/bt_auto_dumper/_v2/__main__.py
Outdated
wallet | ||
"/path/test.zip", | ||
wallet, | ||
"mainnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"mainnet" | |
"mainnet", |
autovalidator_address, subnet_identifier, __, __, __ = load_config(config_path=config_path) | ||
__, __, wallet_name, wallet_hotkey, wallet_path = load_config(config_path=config_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not good but I'm so tired of this PR I'll let it slide
Fix the autodetection of bittensor wallet
Fix the commands as list type
Add the feature for requesting commands to auto-validator server