bladekit 4.60.0__tar.gz → 4.62.0__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.
- {bladekit-4.60.0 → bladekit-4.62.0}/PKG-INFO +1 -1
- {bladekit-4.60.0 → bladekit-4.62.0}/pyproject.toml +1 -1
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_app.py +41 -1
- {bladekit-4.60.0 → bladekit-4.62.0}/.gitignore +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/README.md +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/__init__.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_banner.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_batch.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_bucket.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_build.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_bundle.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_client.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_cls.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_constants.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_cron.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_dict.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_env.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_exported_metrics.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_image.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_loader.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_map.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_metrics_cli.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_preempt.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_queue.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_render.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_runner_api.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_sandbox.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_secret.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_serialize.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_serve.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_volume.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/_webhook.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/cli.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/config.py +0 -0
- {bladekit-4.60.0 → bladekit-4.62.0}/src/bladekit/exceptions.py +0 -0
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
# uninstalled during an upgrade, and `forge` is a different project's name on
|
|
17
17
|
# public PyPI.
|
|
18
18
|
name = "bladekit"
|
|
19
|
-
version = "4.
|
|
19
|
+
version = "4.62.0"
|
|
20
20
|
description = "Blade AI Fabric SDK + CLI — run Python functions on Blade's GPU fleet."
|
|
21
21
|
readme = "README.md"
|
|
22
22
|
requires-python = ">=3.10"
|
|
@@ -13,6 +13,7 @@ This is the ergonomic surface (SPEC §1). It also owns the run lifecycle a singl
|
|
|
13
13
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
+
import json
|
|
16
17
|
import sys
|
|
17
18
|
import time
|
|
18
19
|
import re
|
|
@@ -168,6 +169,12 @@ class Autoscale:
|
|
|
168
169
|
Requires a control plane of 2026-08-11 or newer (contracts CHANGELOG,
|
|
169
170
|
autoscaling anti-flap entry): older control planes reject the unknown
|
|
170
171
|
policy field with ``400 SCALING_POLICY_INVALID``.
|
|
172
|
+
- ``health``: a declared replica-health rule (``docs/specs/replica-health.md``),
|
|
173
|
+
sent verbatim as ``scaling_policy.health`` so the endpoint's first replica
|
|
174
|
+
starts with the metrics its rule needs. The control plane validates it.
|
|
175
|
+
Unset = no ``health`` key, as before. ``Autoscale(health={...})`` alone adds
|
|
176
|
+
no scaling target. ``web_server`` / ``asgi_app`` only (``web_endpoint`` is out
|
|
177
|
+
of scope); ``vllm_slow_peer_ratio`` needs ``web_server``.
|
|
171
178
|
|
|
172
179
|
Example::
|
|
173
180
|
|
|
@@ -185,6 +192,7 @@ class Autoscale:
|
|
|
185
192
|
buffer_replicas: Optional[int] = None
|
|
186
193
|
vllm_target_waiting: Optional[int] = None
|
|
187
194
|
scaledown_window: Optional[int] = None
|
|
195
|
+
health: Optional[Mapping[str, Any]] = None
|
|
188
196
|
|
|
189
197
|
def __post_init__(self) -> None:
|
|
190
198
|
if (
|
|
@@ -192,12 +200,28 @@ class Autoscale:
|
|
|
192
200
|
and self.buffer_replicas is None
|
|
193
201
|
and self.vllm_target_waiting is None
|
|
194
202
|
and self.scaledown_window is None
|
|
203
|
+
and self.health is None
|
|
195
204
|
):
|
|
196
205
|
raise exc.InvalidArgumentError(
|
|
197
206
|
"SCALING_POLICY_INVALID",
|
|
198
207
|
"bladekit.Autoscale requires at least one of target_inputs, "
|
|
199
|
-
"buffer_replicas, vllm_target_waiting, scaledown_window",
|
|
208
|
+
"buffer_replicas, vllm_target_waiting, scaledown_window, health",
|
|
200
209
|
)
|
|
210
|
+
if self.health is not None:
|
|
211
|
+
if not isinstance(self.health, Mapping) or not self.health or not all(
|
|
212
|
+
isinstance(k, str) for k in self.health
|
|
213
|
+
):
|
|
214
|
+
raise exc.InvalidArgumentError(
|
|
215
|
+
"SCALING_POLICY_INVALID",
|
|
216
|
+
"health must be a non-empty mapping with string keys",
|
|
217
|
+
)
|
|
218
|
+
try:
|
|
219
|
+
canonical = json.loads(json.dumps(dict(self.health), allow_nan=False))
|
|
220
|
+
object.__setattr__(self, "health", canonical)
|
|
221
|
+
except (TypeError, ValueError) as e:
|
|
222
|
+
raise exc.InvalidArgumentError(
|
|
223
|
+
"SCALING_POLICY_INVALID", f"health must be JSON-serializable: {e}"
|
|
224
|
+
) from None
|
|
201
225
|
if self.target_inputs is not None and (
|
|
202
226
|
not isinstance(self.target_inputs, int)
|
|
203
227
|
or isinstance(self.target_inputs, bool)
|
|
@@ -2288,6 +2312,17 @@ def _validate_endpoint_autoscale(kind: str, autoscale: Optional[Autoscale]) -> N
|
|
|
2288
2312
|
"SCALING_POLICY_INVALID",
|
|
2289
2313
|
f"vllm_target_waiting requires @app.web_server (got {kind})",
|
|
2290
2314
|
)
|
|
2315
|
+
# replica-health.md §7: no health on web_endpoint; the vLLM preset needs web_server.
|
|
2316
|
+
if autoscale.health is not None and kind == "web_endpoint":
|
|
2317
|
+
raise exc.InvalidArgumentError(
|
|
2318
|
+
"SCALING_POLICY_INVALID",
|
|
2319
|
+
"health requires @app.web_server or @app.asgi_app (got web_endpoint)",
|
|
2320
|
+
)
|
|
2321
|
+
if autoscale.health is not None and "vllm_slow_peer_ratio" in autoscale.health and kind != "web_server":
|
|
2322
|
+
raise exc.InvalidArgumentError(
|
|
2323
|
+
"SCALING_POLICY_INVALID",
|
|
2324
|
+
f"vllm_slow_peer_ratio requires @app.web_server (got {kind})",
|
|
2325
|
+
)
|
|
2291
2326
|
|
|
2292
2327
|
|
|
2293
2328
|
def _autoscaling_spec(
|
|
@@ -2355,6 +2390,7 @@ def _scaling_policy_spec(
|
|
|
2355
2390
|
buffer_replicas: Optional[int] = None
|
|
2356
2391
|
vllm_waiting: Optional[int] = None
|
|
2357
2392
|
scaledown_window: Optional[int] = None
|
|
2393
|
+
health: Optional[Mapping[str, Any]] = None
|
|
2358
2394
|
if autoscale is not None:
|
|
2359
2395
|
if autoscale.target_inputs is not None:
|
|
2360
2396
|
if target is not None:
|
|
@@ -2367,11 +2403,13 @@ def _scaling_policy_spec(
|
|
|
2367
2403
|
buffer_replicas = autoscale.buffer_replicas
|
|
2368
2404
|
vllm_waiting = autoscale.vllm_target_waiting
|
|
2369
2405
|
scaledown_window = autoscale.scaledown_window
|
|
2406
|
+
health = autoscale.health
|
|
2370
2407
|
if (
|
|
2371
2408
|
target is None
|
|
2372
2409
|
and buffer_replicas is None
|
|
2373
2410
|
and vllm_waiting is None
|
|
2374
2411
|
and scaledown_window is None
|
|
2412
|
+
and health is None
|
|
2375
2413
|
):
|
|
2376
2414
|
return None
|
|
2377
2415
|
if target is not None and target > max_concurrent_inputs:
|
|
@@ -2397,6 +2435,8 @@ def _scaling_policy_spec(
|
|
|
2397
2435
|
# unknown policy fields with 400 SCALING_POLICY_INVALID.
|
|
2398
2436
|
if scaledown_window is not None:
|
|
2399
2437
|
policy["scaledown_window_seconds"] = scaledown_window
|
|
2438
|
+
if health is not None:
|
|
2439
|
+
policy["health"] = dict(health)
|
|
2400
2440
|
if len(policy) == 1:
|
|
2401
2441
|
return None # only {"v":1} left (e.g. buffer_replicas=0): no policy
|
|
2402
2442
|
return policy
|
|
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
|
|
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
|