From 71b416c4bc2e86928934eade3fbb7863c52c0bc5 Mon Sep 17 00:00:00 2001 From: Jvst Me Date: Thu, 16 Jul 2026 11:44:06 +0200 Subject: [PATCH] Detect Vast.ai interruptions during provisioning Detect spot interruptions and terminate the instance without waiting for provisioning timeout to elapse. --- src/dstack/_internal/core/backends/vastai/compute.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dstack/_internal/core/backends/vastai/compute.py b/src/dstack/_internal/core/backends/vastai/compute.py index 3ee5c3d02..6843135ed 100644 --- a/src/dstack/_internal/core/backends/vastai/compute.py +++ b/src/dstack/_internal/core/backends/vastai/compute.py @@ -205,6 +205,16 @@ def update_provisioning_data( and ": OCI runtime create failed:" in resp["status_msg"] ): raise ProvisioningError(resp["status_msg"]) + if ( + resp.get("cur_state") + == resp.get("intended_status") + == resp.get("next_state") + == "stopped" + ): + # Can happen, among other cases, when a spot instance is outbid (interrupted) + raise ProvisioningError( + "Vast.ai reports current and intended instance state as `stopped`" + ) class VastAIOfferBackendData(CoreModel):