-
-
Notifications
You must be signed in to change notification settings - Fork 232
fix(backends/vastai): route /instances/ to /api/v1/ (v0 deprecated, returns HTTP 410) #3969
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,13 @@ def auth_test(self) -> bool: | |
| return False | ||
|
|
||
| def _url(self, path): | ||
| return f"{self.api_url}/{path.lstrip('/')}?api_key={self.api_key}" | ||
| base = self.api_url | ||
| # Vast.ai deprecated /api/v0/instances/ (HTTP 410). /api/v1/instances/ | ||
| # returns a schema-compatible response (success flag + instances list). | ||
| # /bundles/ and /asks/ remain on v0; v1 is not yet published for them. | ||
| if path.lstrip("/").startswith("instances/"): | ||
| base = base.replace("/api/v0", "/api/v1") | ||
|
Comment on lines
+142
to
+143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Routing Useful? React with 👍 / 👎. |
||
| return f"{base}/{path.lstrip('/')}?api_key={self.api_key}" | ||
|
|
||
| def _invalidate_cache(self): | ||
| with self.lock: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prefix check sends every
/instances/...URL to v1, includingdestroy_instance()andrequest_logs(). The current Vast docs only move the list endpoint toGET /api/v1/instances/; they still document destruction asDELETE /api/v0/instances/{id}/and logs asPUT /api/v0/instances/request_logs/{id}. In VastAI runs,terminate_instance()relies ondestroy_instance()and ignores a false return, so routing deletes to an unpublished v1 endpoint can leave paid instances running while also breaking log retrieval.Useful? React with 👍 / 👎.