Skip to content
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

Return-the-miner-version-on-the-Allocation-request #275

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
4 changes: 2 additions & 2 deletions neurons/Miner/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions neurons/register_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class Allocation(BaseModel):
ssh_command: str = ""
ssh_key: str = ""
uuid_key: str = ""
miner_version: int = 0


class DockerRequirement(BaseModel):
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand Down