Skip to content

Commit

Permalink
Merge pull request #287 from neuralinternet/csn-567-on-allocation-ret…
Browse files Browse the repository at this point in the history
…urn-miner-version-from-axon-info

fix(CSN-567): On allocation return miner version from axon info
  • Loading branch information
mo0haned authored Feb 3, 2025
2 parents 2e5d16d + 98c5527 commit 3d54a96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions neurons/Miner/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from io import BytesIO
import sys
from docker.types import DeviceRequest
from compute import __version_as_int__
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)

Expand Down Expand Up @@ -178,7 +177,7 @@ def run_container(cpu_usage, ram_usage, hard_disk_usage, gpu_usage, public_key,
# Check the status to determine if the container ran successfully
if container.status == "created":
bt.logging.info("Container was created successfully.")
info = {"username": "root", "password": password, "port": docker_ssh_port, "version" : __version_as_int__}
info = {"username": "root", "password": password, "port": docker_ssh_port}
info_str = json.dumps(info)
public_key = public_key.encode("utf-8")
encrypted_info = rsa.encrypt_data(public_key, info_str)
Expand Down
5 changes: 3 additions & 2 deletions neurons/register_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ async def allocate_spec(requirements: DeviceRequirement, docker_requirement: Doc
allocated.ssh_password = info["password"]
allocated.uuid_key = info["uuid"]
allocated.ssh_command = f"ssh {info['username']}@{result['ip']} -p {str(info['port'])}"
allocated.miner_version = info.get("version", 0)
allocated.miner_version = result.get("miner_version", 0)
update_allocation_db(result_hotkey, info, True)
await self._update_allocation_wandb()
bt.logging.info(f"API: Resource {result_hotkey} was successfully allocated")
Expand Down Expand Up @@ -668,7 +668,7 @@ async def allocate_hotkey(hotkey: str, ssh_key: Optional[str] = None,
allocated.ssh_password = info["password"]
allocated.uuid_key = info["uuid"]
allocated.ssh_command = f"ssh {info['username']}@{result['ip']} -p {str(info['port'])}"
allocated.miner_version = info.get("version", 0)
allocated.miner_version = result.get("miner_version", 0)
update_allocation_db(result_hotkey, info, True)
await self._update_allocation_wandb()

Expand Down Expand Up @@ -2877,6 +2877,7 @@ async def _allocate_container_hotkey(self, requirements, hotkey, timeline, publi
if register_response and register_response["status"] is True:
register_response["ip"] = axon.ip
register_response["hotkey"] = axon.hotkey
register_response["miner_version"] = axon.version
return register_response
else:
bt.logging.warning(
Expand Down

0 comments on commit 3d54a96

Please sign in to comment.