Skip to content

Commit d2846ae

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Resolve Remaining Review Comments
1 parent 16e77e3 commit d2846ae

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/dstack/_internal/core/backends/hotaisle/api_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ def upload_ssh_key(self, public_key: str) -> bool:
6868
response.raise_for_status()
6969
return True
7070

71-
def create_virtual_machine(
72-
self, vm_payload: Dict[str, Any], instance_name: str
73-
) -> Dict[str, Any]:
71+
def create_virtual_machine(self, vm_payload: Dict[str, Any]) -> Dict[str, Any]:
7472
url = f"{API_URL}/teams/{self.team_handle}/virtual_machines/"
7573
response = self._make_request("POST", url, json=vm_payload)
7674
response.raise_for_status()
@@ -87,6 +85,9 @@ def get_vm_state(self, vm_name: str) -> str:
8785
def terminate_virtual_machine(self, vm_name: str) -> None:
8886
url = f"{API_URL}/teams/{self.team_handle}/virtual_machines/{vm_name}/"
8987
response = self._make_request("DELETE", url)
88+
if response.status_code == 404:
89+
logger.debug("Hot Aisle virtual machine %s not found", vm_name)
90+
return
9091
response.raise_for_status()
9192

9293
def _make_request(

src/dstack/_internal/core/backends/hotaisle/compute.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from dstack._internal.core.backends.base.compute import (
1111
Compute,
1212
ComputeWithCreateInstanceSupport,
13-
generate_unique_instance_name,
1413
get_shim_commands,
1514
)
1615
from dstack._internal.core.backends.base.offers import get_catalog_offers
@@ -115,13 +114,10 @@ def create_instance(
115114
instance_config: InstanceConfiguration,
116115
placement_group: Optional[PlacementGroup],
117116
) -> JobProvisioningData:
118-
instance_name = generate_unique_instance_name(
119-
instance_config, max_length=MAX_INSTANCE_NAME_LEN
120-
)
121117
project_ssh_key = instance_config.ssh_keys[0]
122118
self.api_client.upload_ssh_key(project_ssh_key.public)
123119
vm_payload = self.get_payload_from_offer(instance_offer.instance)
124-
vm_data = self.api_client.create_virtual_machine(vm_payload, instance_name)
120+
vm_data = self.api_client.create_virtual_machine(vm_payload)
125121
return JobProvisioningData(
126122
backend=instance_offer.backend,
127123
instance_type=instance_offer.instance,
@@ -178,27 +174,13 @@ def _start_runner(
178174
project_ssh_private_key: str,
179175
launch_command: str,
180176
):
181-
_setup_instance(
182-
hostname=hostname,
183-
ssh_private_key=project_ssh_private_key,
184-
)
185177
_launch_runner(
186178
hostname=hostname,
187179
ssh_private_key=project_ssh_private_key,
188180
launch_command=launch_command,
189181
)
190182

191183

192-
def _setup_instance(
193-
hostname: str,
194-
ssh_private_key: str,
195-
):
196-
setup_commands = ("sudo apt-get update",)
197-
_run_ssh_command(
198-
hostname=hostname, ssh_private_key=ssh_private_key, command=" && ".join(setup_commands)
199-
)
200-
201-
202184
def _launch_runner(
203185
hostname: str,
204186
ssh_private_key: str,

0 commit comments

Comments
 (0)