vastai-sdk 0.3.3.dev4__tar.gz → 0.3.4.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/PKG-INFO +1 -1
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/pyproject.toml +1 -1
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/client/client.py +0 -11
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/lib/backend.py +2 -7
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/lib/metrics.py +21 -10
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/LICENSE +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/README.md +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/__init__.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/__init__.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/client/__init__.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/client/connection.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/client/endpoint.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/client/worker.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/__init__.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/lib/__init__.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/lib/data_types.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/lib/server.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/serverless/server/worker.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/vast.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/vastai_base.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai/vastai_sdk.py +0 -0
- {vastai_sdk-0.3.3.dev4 → vastai_sdk-0.3.4.dev2}/vastai_sdk/__init__.py +0 -0
|
@@ -189,17 +189,6 @@ class Serverless:
|
|
|
189
189
|
raise RuntimeError(f"get_endpoint_workers failed: HTTP {resp.status} - {text}")
|
|
190
190
|
|
|
191
191
|
data = await resp.json(content_type=None)
|
|
192
|
-
|
|
193
|
-
# If error message from authenticate_endpoint_apikey_by_id occurs, there is a possibility that
|
|
194
|
-
# the endpoint's worker instances are not ready to be queried. If an error message occurs,
|
|
195
|
-
# return an empty list and print the error message to the user. The endpoint get_endpoint_workers
|
|
196
|
-
# should normally return a list of dictionaries containing worker instance information.
|
|
197
|
-
if isinstance(data,dict):
|
|
198
|
-
if 'error_msg' in data.keys():
|
|
199
|
-
self.logger.warning(f"Received the following error from get_endpoint_workers:{data['error_msg']}.\nEndpoint may not be ready for query. Check credentials or wait a few minutes and try again.")
|
|
200
|
-
return []
|
|
201
|
-
|
|
202
|
-
|
|
203
192
|
if not isinstance(data, list):
|
|
204
193
|
raise RuntimeError(f"Unexpected response type (wanted list): {type(data)}")
|
|
205
194
|
|
|
@@ -32,7 +32,7 @@ from .data_types import (
|
|
|
32
32
|
BenchmarkResult
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
VERSION = "1.0.
|
|
35
|
+
VERSION = "1.0.1"
|
|
36
36
|
|
|
37
37
|
MSG_HISTORY_LEN = 100
|
|
38
38
|
log = logging.getLogger(__file__)
|
|
@@ -344,16 +344,11 @@ class Backend:
|
|
|
344
344
|
return False
|
|
345
345
|
|
|
346
346
|
message = {
|
|
347
|
-
|
|
348
|
-
for (key, value) in (dataclasses.asdict(auth_data).items())
|
|
349
|
-
if key != "signature" and key != "__request_id"
|
|
347
|
+
"url" : auth_data.url
|
|
350
348
|
}
|
|
351
349
|
if auth_data.reqnum < (self.reqnum - MSG_HISTORY_LEN):
|
|
352
350
|
log.error(f"Signature error: reqnum failure, got {auth_data.reqnum}, current_reqnum: {self.reqnum}")
|
|
353
351
|
return False
|
|
354
|
-
elif message in self.msg_history:
|
|
355
|
-
log.error(f"Signature error: message {message} already in message history")
|
|
356
|
-
return False
|
|
357
352
|
elif verify_signature(json.dumps(message, indent=4, sort_keys=True), auth_data.signature):
|
|
358
353
|
self.reqnum = max(auth_data.reqnum, self.reqnum)
|
|
359
354
|
self.msg_history.append(message)
|
|
@@ -151,13 +151,16 @@ class Metrics:
|
|
|
151
151
|
#######################################Private#######################################
|
|
152
152
|
|
|
153
153
|
async def __send_delete_requests_and_reset(self):
|
|
154
|
-
async def post(report_addr: str,
|
|
154
|
+
async def post(report_addr: str, idxs: list[int], success_flag: bool) -> bool:
|
|
155
155
|
data = {
|
|
156
156
|
"worker_id": self.id,
|
|
157
157
|
"mtoken": self.mtoken,
|
|
158
|
-
"
|
|
158
|
+
"request_idxs": idxs,
|
|
159
|
+
"success": success_flag,
|
|
159
160
|
}
|
|
160
|
-
log.debug(
|
|
161
|
+
log.debug(
|
|
162
|
+
f"Deleting requests that {'succeeded' if success_flag else 'failed'}: {data['request_idxs']}"
|
|
163
|
+
)
|
|
161
164
|
full_path = report_addr.rstrip("/") + "/delete_requests/"
|
|
162
165
|
for attempt in range(1, 4):
|
|
163
166
|
try:
|
|
@@ -174,12 +177,13 @@ class Metrics:
|
|
|
174
177
|
log.debug(f"Retrying delete_request, attempt: {attempt}")
|
|
175
178
|
return False
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
]
|
|
180
|
+
# Take a snapshot of what we plan to send this tick.
|
|
181
|
+
# New arrivals after this snapshot will remain in the queue for the next tick.
|
|
182
|
+
snapshot = list(self.model_metrics.requests_deleting)
|
|
183
|
+
success_idxs = [r.request_idx for r in snapshot if r.success is True]
|
|
184
|
+
failed_idxs = [r.request_idx for r in snapshot if r.success is False]
|
|
181
185
|
|
|
182
|
-
if not
|
|
186
|
+
if not success_idxs and not failed_idxs:
|
|
183
187
|
return # nothing to do
|
|
184
188
|
|
|
185
189
|
for report_addr in self.report_addr:
|
|
@@ -187,10 +191,17 @@ class Metrics:
|
|
|
187
191
|
if report_addr == "https://cloud.vast.ai/api/v0":
|
|
188
192
|
# Patch: ignore the Redis API report_addr
|
|
189
193
|
continue
|
|
194
|
+
sent_success = True
|
|
195
|
+
sent_failed = True
|
|
196
|
+
|
|
197
|
+
if success_idxs:
|
|
198
|
+
sent_success = await post(report_addr, success_idxs, True)
|
|
199
|
+
if failed_idxs:
|
|
200
|
+
sent_failed = await post(report_addr, failed_idxs, False)
|
|
190
201
|
|
|
191
|
-
if
|
|
202
|
+
if sent_success and sent_failed:
|
|
192
203
|
# Remove only the items we actually sent from the live queue.
|
|
193
|
-
sent_set =
|
|
204
|
+
sent_set = set(success_idxs) | set(failed_idxs)
|
|
194
205
|
self.model_metrics.requests_deleting[:] = [
|
|
195
206
|
r for r in self.model_metrics.requests_deleting
|
|
196
207
|
if r.request_idx not in sent_set
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|