diff --git a/neurons/Miner/container.py b/neurons/Miner/container.py index 6752b726..dd911c08 100644 --- a/neurons/Miner/container.py +++ b/neurons/Miner/container.py @@ -28,7 +28,7 @@ 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) @@ -194,7 +194,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} + info = {"username": "root", "password": password, "port": docker_ssh_port, "version" : __version_as_int__} info_str = json.dumps(info) public_key = public_key.encode("utf-8") encrypted_info = rsa.encrypt_data(public_key, info_str) diff --git a/neurons/register_api.py b/neurons/register_api.py index f2029995..8b2cb9cf 100644 --- a/neurons/register_api.py +++ b/neurons/register_api.py @@ -162,6 +162,7 @@ class Allocation(BaseModel): ssh_command: str = "" ssh_key: str = "" uuid_key: str = "" + miner_version: int = 0 class DockerRequirement(BaseModel): @@ -518,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) update_allocation_db(result_hotkey, info, True) await self._update_allocation_wandb() bt.logging.info(f"API: Resource {result_hotkey} was successfully allocated") @@ -667,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) update_allocation_db(result_hotkey, info, True) await self._update_allocation_wandb() @@ -1390,6 +1391,7 @@ async def list_allocations() -> JSONResponse: ) entry.uuid_key = info["uuid"] entry.ssh_key = info["ssh_key"] + entry.miner_version = info.get("version", 0) allocation_list.append(entry) except Exception as e: