Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions btqs/btqs_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self):
self.fast_blocks = True
self.workspace_path = None
self.subtensor_branch = None
self.skip_rust = None
self.steps = [
{
"title": "Start Local Subtensor",
Expand All @@ -100,6 +101,7 @@ def __init__(self):
branch=self.subtensor_branch,
fast_blocks=self.fast_blocks,
verbose=self.verbose,
skip_rust=self.skip_rust,
),
},
{
Expand Down Expand Up @@ -142,6 +144,9 @@ def start_chain(
verbose: bool = typer.Option(
False, "--verbose", "-v", help="Enable verbose output"
),
skip_rust: bool = typer.Option(
False, "--skip-rust", help="Skip Rust installation"
),
):
"""
Starts the local Subtensor chain.
Expand Down Expand Up @@ -187,6 +192,7 @@ def start_chain(
branch,
fast_blocks=fast_blocks,
verbose=verbose,
skip_rust=skip_rust,
)

def stop_chain(self):
Expand Down Expand Up @@ -237,6 +243,9 @@ def run_all(
verbose: bool = typer.Option(
False, "--verbose", "-v", help="Enable verbose output"
),
skip_rust: bool = typer.Option(
False, "--skip-rust", help="Skip Rust installation"
),
):
"""
Runs all commands in sequence to set up and start the local chain, subnet, and neurons.
Expand All @@ -245,6 +254,7 @@ def run_all(
self.workspace_path = workspace_path
self.fast_blocks = fast_blocks
self.verbose = verbose
self.skip_rust = skip_rust

console.clear()
print_info("Welcome to the Bittensor Quick Start Tutorial", emoji="🚀")
Expand Down
19 changes: 13 additions & 6 deletions btqs/commands/chain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import os
import subprocess
import time
Expand Down Expand Up @@ -209,7 +210,7 @@ async def sudo_set_tempo(
return await response.is_success


def start(config_data, workspace_path, branch, fast_blocks=True, verbose=False):
def start(config_data, workspace_path, branch, fast_blocks=True, verbose=False, skip_rust=False):
os.makedirs(workspace_path, exist_ok=True)
subtensor_path = os.path.join(workspace_path, "subtensor")

Expand Down Expand Up @@ -250,11 +251,17 @@ def start(config_data, workspace_path, branch, fast_blocks=True, verbose=False):
else:
print_info("Fast blocks are Off", emoji="🐌 ")

venv_subtensor_path = os.path.join(workspace_path, "venv_subtensor")
venv_python = create_virtualenv(venv_subtensor_path)
install_subtensor_dependencies(verbose)

config_data["venv_subtensor"] = venv_python
if skip_rust:
venv_python = sys.executable
print_info("Skipping Rust installation", emoji="🦘 ")
config_data["venv_subtensor"] = "None"
venv_subtensor_path = "None"
else:
venv_subtensor_path = os.path.join(workspace_path, "venv_subtensor")
venv_python = create_virtualenv(venv_subtensor_path)
install_subtensor_dependencies(verbose)
print_info("Virtual environment created and dependencies installed.", emoji="🐍 ")
config_data["venv_subtensor"] = venv_python

# Running localnet.sh using the virtual environment's Python
localnet_path = os.path.join(subtensor_path, "scripts", "localnet.sh")
Expand Down
10 changes: 7 additions & 3 deletions btqs/commands/subnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ def add_weights(config_data):
hotkey=owner_data.get("hotkey"),
)
print_info(
"Validator is now setting weights of subnet 1 on the root network.\n Please wait... (Timeout: 60 seconds)",
"Validator is now setting weights of subnet 1 on the root network.\n Please wait... (Timeout: ~ 120 seconds)",
emoji="🏋️ ",
)
max_retries = 30
max_retries = 60
attempt = 0
retry_patterns = ["ancient birth block", "Transaction has a bad signature"]
retry_patterns = [
"ancient birth block",
"Transaction has a bad signature",
"SettingWeightsTooFast",
]

while attempt < max_retries:
try:
Expand Down