bladekit 4.43.0__tar.gz → 4.43.2__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.
Files changed (35) hide show
  1. {bladekit-4.43.0 → bladekit-4.43.2}/PKG-INFO +1 -1
  2. {bladekit-4.43.0 → bladekit-4.43.2}/pyproject.toml +1 -1
  3. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_app.py +30 -4
  4. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_map.py +16 -0
  5. {bladekit-4.43.0 → bladekit-4.43.2}/.gitignore +0 -0
  6. {bladekit-4.43.0 → bladekit-4.43.2}/README.md +0 -0
  7. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/__init__.py +0 -0
  8. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_banner.py +0 -0
  9. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_batch.py +0 -0
  10. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_bucket.py +0 -0
  11. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_build.py +0 -0
  12. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_bundle.py +0 -0
  13. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_client.py +0 -0
  14. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_cls.py +0 -0
  15. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_constants.py +0 -0
  16. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_cron.py +0 -0
  17. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_dict.py +0 -0
  18. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_env.py +0 -0
  19. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_exported_metrics.py +0 -0
  20. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_image.py +0 -0
  21. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_loader.py +0 -0
  22. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_metrics_cli.py +0 -0
  23. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_preempt.py +0 -0
  24. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_queue.py +0 -0
  25. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_render.py +0 -0
  26. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_runner_api.py +0 -0
  27. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_sandbox.py +0 -0
  28. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_secret.py +0 -0
  29. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_serialize.py +0 -0
  30. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_serve.py +0 -0
  31. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_volume.py +0 -0
  32. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/_webhook.py +0 -0
  33. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/cli.py +0 -0
  34. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/config.py +0 -0
  35. {bladekit-4.43.0 → bladekit-4.43.2}/src/bladekit/exceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bladekit
3
- Version: 4.43.0
3
+ Version: 4.43.2
4
4
  Summary: Blade AI Fabric SDK + CLI — run Python functions on Blade's GPU fleet.
5
5
  Project-URL: Homepage, https://blade.sh
6
6
  Project-URL: Documentation, https://console.blade.sh
@@ -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.43.0"
19
+ version = "4.43.2"
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"
@@ -1173,8 +1173,9 @@ class Function:
1173
1173
  retries: override the retry policy for this batch, e.g.
1174
1174
  ``{"max_retries": 3, "backoff": {"initial_seconds": 1,
1175
1175
  "max_seconds": 60, "factor": 2.0}}``.
1176
- input_timeout_seconds: per-input timeout (distinct from the run
1177
- global ``timeout=``).
1176
+ input_timeout_seconds: per-input timeout. Defaults to the
1177
+ function's ``timeout=`` (max seconds for ONE execution); an
1178
+ input that exceeds it fails with INPUT_TIMEOUT (retries apply).
1178
1179
  priority: scheduling priority 0–9 (9=urgent, 0=best-effort batch).
1179
1180
  Defaults to the function's priority or 5 (FIFO).
1180
1181
  namespace: override the namespace for quota accounting.
@@ -1330,6 +1331,7 @@ class Function:
1330
1331
  from ._map import spawn_map as _spawn_map_impl
1331
1332
  from ._serialize import cloudpickle_version
1332
1333
 
1334
+ self._refuse_map_bucket_mounts()
1333
1335
  client = self._app._require_client()
1334
1336
  bundle_id = self._app._ensure_bundle()
1335
1337
  image_str, image_build_id = self._resolve_image()
@@ -1356,13 +1358,17 @@ class Function:
1356
1358
  app_name=self._app.name if self._app.name else None,
1357
1359
  inputs=inputs,
1358
1360
  retries=eff_retries,
1359
- input_timeout_seconds=input_timeout_seconds,
1361
+ input_timeout_seconds=self._map_input_timeout(input_timeout_seconds),
1360
1362
  priority=eff_priority,
1361
1363
  namespace=eff_namespace,
1362
1364
  max_concurrency=max_concurrency,
1363
1365
  gpu_class=self.gpu_class,
1364
1366
  best_effort=self.best_effort,
1365
1367
  max_interruptions=self.max_interruptions,
1368
+ # The worker runs carry the function's volumes and secrets, as a
1369
+ # single run does.
1370
+ volumes=self._volume_specs(),
1371
+ secrets=self._secret_names(),
1366
1372
  )
1367
1373
 
1368
1374
  def _run_map(
@@ -1381,6 +1387,7 @@ class Function:
1381
1387
  from ._map import run_map
1382
1388
  from ._serialize import cloudpickle_version
1383
1389
 
1390
+ self._refuse_map_bucket_mounts()
1384
1391
  client = self._app._require_client()
1385
1392
  bundle_id = self._app._ensure_bundle()
1386
1393
  image_str, image_build_id = self._resolve_image()
@@ -1413,7 +1420,7 @@ class Function:
1413
1420
  order=order,
1414
1421
  return_exceptions=return_exceptions,
1415
1422
  retries=eff_retries,
1416
- input_timeout_seconds=input_timeout_seconds,
1423
+ input_timeout_seconds=self._map_input_timeout(input_timeout_seconds),
1417
1424
  priority=eff_priority,
1418
1425
  namespace=eff_namespace,
1419
1426
  max_concurrency=max_concurrency,
@@ -1422,8 +1429,27 @@ class Function:
1422
1429
  gpu_class=self.gpu_class,
1423
1430
  best_effort=self.best_effort,
1424
1431
  max_interruptions=self.max_interruptions,
1432
+ volumes=self._volume_specs(),
1433
+ secrets=self._secret_names(),
1425
1434
  )
1426
1435
 
1436
+ def _refuse_map_bucket_mounts(self) -> None:
1437
+ """Map workers cannot mount a CloudBucketMount yet (the control plane
1438
+ has no bucket mounts on POST /v1/maps): refuse before any request
1439
+ rather than start workers whose mount path is silently empty."""
1440
+ if self._bucket_mount_specs():
1441
+ raise exc.InvalidArgumentError(
1442
+ "INVALID_ARGUMENT",
1443
+ "bucket mounts are not supported on map yet; use .remote()/.spawn()",
1444
+ )
1445
+
1446
+ def _map_input_timeout(self, explicit: Optional[int]) -> Optional[int]:
1447
+ """Per-input timeout of a map: explicit argument > the function's
1448
+ ``timeout=``. ``timeout=`` is the max seconds for ONE execution, and a
1449
+ map execution is one input — never the lifetime of a worker run, which
1450
+ serves many inputs. None ⇒ no per-input limit (the server default)."""
1451
+ return explicit if explicit is not None else self.timeout
1452
+
1427
1453
  # -- result resolution --------------------------------------------------
1428
1454
 
1429
1455
  def _await_call(
@@ -114,6 +114,8 @@ def _create_map_batch(
114
114
  gpu_class: str,
115
115
  best_effort: bool,
116
116
  max_interruptions: Optional[int],
117
+ volumes: Optional[List[dict]],
118
+ secrets: Optional[List[str]],
117
119
  ) -> str:
118
120
  """Create a map invocation, push inputs, finalize; return its ``map_id``.
119
121
 
@@ -134,6 +136,12 @@ def _create_map_batch(
134
136
  body["image"] = image
135
137
  if image_build_id is not None:
136
138
  body["image_build_id"] = image_build_id
139
+ # The worker runs' volumes and secrets, in the run-create shape (resources
140
+ # already carries timeout_seconds). Omitted when empty, like the run body.
141
+ if volumes:
142
+ body["volumes"] = volumes
143
+ if secrets:
144
+ body["secrets"] = secrets
137
145
  if app_name:
138
146
  body["app_name"] = app_name
139
147
  if retries is not None:
@@ -199,6 +207,8 @@ def run_map(
199
207
  gpu_class: str = "spot",
200
208
  best_effort: bool = False,
201
209
  max_interruptions: Optional[int] = None,
210
+ volumes: Optional[List[dict]] = None,
211
+ secrets: Optional[List[str]] = None,
202
212
  ) -> Generator[Any, None, None]:
203
213
  """Create a map batch, push inputs, finalize, stream results.
204
214
 
@@ -226,6 +236,8 @@ def run_map(
226
236
  gpu_class=gpu_class,
227
237
  best_effort=best_effort,
228
238
  max_interruptions=max_interruptions,
239
+ volumes=volumes,
240
+ secrets=secrets,
229
241
  )
230
242
 
231
243
  # Stream results.
@@ -256,6 +268,8 @@ def spawn_map(
256
268
  gpu_class: str = "spot",
257
269
  best_effort: bool = False,
258
270
  max_interruptions: Optional[int] = None,
271
+ volumes: Optional[List[dict]] = None,
272
+ secrets: Optional[List[str]] = None,
259
273
  ) -> "MapHandle":
260
274
  """Fire an async fan-out and return a :class:`MapHandle` WITHOUT blocking.
261
275
 
@@ -283,6 +297,8 @@ def spawn_map(
283
297
  gpu_class=gpu_class,
284
298
  best_effort=best_effort,
285
299
  max_interruptions=max_interruptions,
300
+ volumes=volumes,
301
+ secrets=secrets,
286
302
  )
287
303
  return MapHandle(client, map_id)
288
304
 
File without changes
File without changes
File without changes