Skip to content
Closed
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
17 changes: 12 additions & 5 deletions lib/iris/src/iris/cluster/platform/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,9 @@ def terminate(self) -> None:
f"--project={self._project_id}",
f"--zone={self._zone}",
"--quiet",
"--async",
]
logger.info("Deleting GCE instance: %s", self._gce_vm_name)
logger.info("Deleting GCE instance (async): %s", self._gce_vm_name)
logger.info("gcloud command: %s", cmd)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
Expand Down Expand Up @@ -585,8 +586,9 @@ def terminate(self) -> None:
f"--zone={self._zone}",
f"--project={self._project_id}",
"--quiet",
"--async",
]
logger.info("Terminating TPU: %s", self._slice_id)
logger.info("Terminating TPU (async): %s", self._slice_id)
logger.info("gcloud command: %s", cmd)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
Expand Down Expand Up @@ -722,8 +724,9 @@ def terminate(self) -> None:
f"--project={self._project_id}",
f"--zone={self._zone}",
"--quiet",
"--async",
]
logger.info("Terminating VM slice: %s (vm=%s)", self._slice_id, self._vm_name)
logger.info("Terminating VM slice (async): %s (vm=%s)", self._slice_id, self._vm_name)
logger.info("gcloud command: %s", cmd)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
Expand Down Expand Up @@ -785,6 +788,7 @@ def _best_effort_delete_tpu(self, slice_id: str, zone: str) -> None:
"""Try to delete a TPU VM that may have been partially created.

Silently ignores "not found" errors (resource was never created).
Uses --async so the caller is not blocked waiting for deletion.
"""
cmd = [
"gcloud",
Expand All @@ -796,8 +800,9 @@ def _best_effort_delete_tpu(self, slice_id: str, zone: str) -> None:
f"--zone={zone}",
f"--project={self._project_id}",
"--quiet",
"--async",
]
logger.info("Best-effort cleanup of TPU %s in %s", slice_id, zone)
logger.info("Best-effort async cleanup of TPU %s in %s", slice_id, zone)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
error = result.stderr.strip()
Expand All @@ -808,6 +813,7 @@ def _best_effort_delete_vm(self, vm_name: str, zone: str) -> None:
"""Try to delete a GCE VM that may have been partially created.

Silently ignores "not found" errors (resource was never created).
Uses --async so the caller is not blocked waiting for deletion.
"""
cmd = [
"gcloud",
Expand All @@ -818,8 +824,9 @@ def _best_effort_delete_vm(self, vm_name: str, zone: str) -> None:
f"--zone={zone}",
f"--project={self._project_id}",
"--quiet",
"--async",
]
logger.info("Best-effort cleanup of VM %s in %s", vm_name, zone)
logger.info("Best-effort async cleanup of VM %s in %s", vm_name, zone)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
error = result.stderr.strip()
Expand Down
Loading