modal 1.1.5.dev91__py3-none-any.whl → 1.2.1__py3-none-any.whl

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.

Potentially problematic release.


This version of modal might be problematic. Click here for more details.

Files changed (49) hide show
  1. modal/_container_entrypoint.py +4 -1
  2. modal/_partial_function.py +28 -3
  3. modal/_utils/function_utils.py +4 -0
  4. modal/_utils/task_command_router_client.py +537 -0
  5. modal/app.py +93 -54
  6. modal/app.pyi +48 -18
  7. modal/cli/_download.py +19 -3
  8. modal/cli/cluster.py +4 -2
  9. modal/cli/container.py +4 -2
  10. modal/cli/entry_point.py +1 -0
  11. modal/cli/launch.py +1 -2
  12. modal/cli/run.py +6 -0
  13. modal/cli/volume.py +7 -1
  14. modal/client.pyi +2 -10
  15. modal/cls.py +5 -12
  16. modal/config.py +14 -0
  17. modal/container_process.py +283 -3
  18. modal/container_process.pyi +95 -32
  19. modal/exception.py +4 -0
  20. modal/experimental/flash.py +21 -47
  21. modal/experimental/flash.pyi +6 -20
  22. modal/functions.pyi +6 -6
  23. modal/io_streams.py +455 -122
  24. modal/io_streams.pyi +220 -95
  25. modal/partial_function.pyi +4 -1
  26. modal/runner.py +39 -36
  27. modal/runner.pyi +40 -24
  28. modal/sandbox.py +130 -11
  29. modal/sandbox.pyi +145 -9
  30. modal/volume.py +23 -3
  31. modal/volume.pyi +30 -0
  32. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/METADATA +5 -5
  33. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/RECORD +49 -48
  34. modal_proto/api.proto +2 -26
  35. modal_proto/api_grpc.py +0 -32
  36. modal_proto/api_pb2.py +327 -367
  37. modal_proto/api_pb2.pyi +6 -69
  38. modal_proto/api_pb2_grpc.py +0 -67
  39. modal_proto/api_pb2_grpc.pyi +0 -22
  40. modal_proto/modal_api_grpc.py +0 -2
  41. modal_proto/sandbox_router.proto +0 -4
  42. modal_proto/sandbox_router_pb2.pyi +0 -4
  43. modal_proto/task_command_router.proto +1 -1
  44. modal_proto/task_command_router_pb2.py +2 -2
  45. modal_version/__init__.py +1 -1
  46. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/WHEEL +0 -0
  47. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/entry_points.txt +0 -0
  48. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/licenses/LICENSE +0 -0
  49. {modal-1.1.5.dev91.dist-info → modal-1.2.1.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,4 @@
1
1
  import modal.client
2
- import modal_proto.api_pb2
3
2
  import subprocess
4
3
  import typing
5
4
  import typing_extensions
@@ -139,7 +138,7 @@ class _FlashPrometheusAutoscaler:
139
138
  async def start(self): ...
140
139
  async def _run_autoscaler_loop(self): ...
141
140
  async def _compute_target_containers(self, current_replicas: int) -> int:
142
- """Gets internal metrics from container to autoscale up or down."""
141
+ """Gets metrics from container to autoscale up or down."""
143
142
  ...
144
143
 
145
144
  def _calculate_desired_replicas(
@@ -154,13 +153,10 @@ class _FlashPrometheusAutoscaler:
154
153
  ...
155
154
 
156
155
  async def _get_scaling_info(self, containers) -> tuple[float, int]:
157
- """Get metrics using either internal container metrics API or prometheus HTTP endpoints."""
156
+ """Get metrics using container exposed metrics endpoints."""
158
157
  ...
159
158
 
160
159
  async def _get_metrics(self, url: str) -> typing.Optional[dict[str, list[typing.Any]]]: ...
161
- async def _get_container_metrics(
162
- self, container_id: str
163
- ) -> typing.Optional[modal_proto.api_pb2.TaskGetAutoscalingMetricsResponse]: ...
164
160
  async def _get_all_containers(self): ...
165
161
  async def _set_target_slots(self, target_slots: int): ...
166
162
  def _make_scaling_decision(
@@ -226,11 +222,11 @@ class FlashPrometheusAutoscaler:
226
222
 
227
223
  class ___compute_target_containers_spec(typing_extensions.Protocol[SUPERSELF]):
228
224
  def __call__(self, /, current_replicas: int) -> int:
229
- """Gets internal metrics from container to autoscale up or down."""
225
+ """Gets metrics from container to autoscale up or down."""
230
226
  ...
231
227
 
232
228
  async def aio(self, /, current_replicas: int) -> int:
233
- """Gets internal metrics from container to autoscale up or down."""
229
+ """Gets metrics from container to autoscale up or down."""
234
230
  ...
235
231
 
236
232
  _compute_target_containers: ___compute_target_containers_spec[typing_extensions.Self]
@@ -248,11 +244,11 @@ class FlashPrometheusAutoscaler:
248
244
 
249
245
  class ___get_scaling_info_spec(typing_extensions.Protocol[SUPERSELF]):
250
246
  def __call__(self, /, containers) -> tuple[float, int]:
251
- """Get metrics using either internal container metrics API or prometheus HTTP endpoints."""
247
+ """Get metrics using container exposed metrics endpoints."""
252
248
  ...
253
249
 
254
250
  async def aio(self, /, containers) -> tuple[float, int]:
255
- """Get metrics using either internal container metrics API or prometheus HTTP endpoints."""
251
+ """Get metrics using container exposed metrics endpoints."""
256
252
  ...
257
253
 
258
254
  _get_scaling_info: ___get_scaling_info_spec[typing_extensions.Self]
@@ -263,16 +259,6 @@ class FlashPrometheusAutoscaler:
263
259
 
264
260
  _get_metrics: ___get_metrics_spec[typing_extensions.Self]
265
261
 
266
- class ___get_container_metrics_spec(typing_extensions.Protocol[SUPERSELF]):
267
- def __call__(
268
- self, /, container_id: str
269
- ) -> typing.Optional[modal_proto.api_pb2.TaskGetAutoscalingMetricsResponse]: ...
270
- async def aio(
271
- self, /, container_id: str
272
- ) -> typing.Optional[modal_proto.api_pb2.TaskGetAutoscalingMetricsResponse]: ...
273
-
274
- _get_container_metrics: ___get_container_metrics_spec[typing_extensions.Self]
275
-
276
262
  class ___get_all_containers_spec(typing_extensions.Protocol[SUPERSELF]):
277
263
  def __call__(self, /): ...
278
264
  async def aio(self, /): ...
modal/functions.pyi CHANGED
@@ -401,7 +401,7 @@ class Function(
401
401
 
402
402
  _call_generator: ___call_generator_spec[typing_extensions.Self]
403
403
 
404
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
404
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
405
405
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
406
406
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
407
407
  ...
@@ -410,7 +410,7 @@ class Function(
410
410
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
411
411
  ...
412
412
 
413
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
413
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
414
414
 
415
415
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
416
416
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -437,7 +437,7 @@ class Function(
437
437
  """
438
438
  ...
439
439
 
440
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
440
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
441
441
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
442
442
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
443
443
 
@@ -461,7 +461,7 @@ class Function(
461
461
  ...
462
462
 
463
463
  _experimental_spawn: ___experimental_spawn_spec[
464
- modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
464
+ modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
465
465
  ]
466
466
 
467
467
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -470,7 +470,7 @@ class Function(
470
470
 
471
471
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
472
472
 
473
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
473
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
474
474
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
475
475
  """Calls the function with the given arguments, without waiting for the results.
476
476
 
@@ -491,7 +491,7 @@ class Function(
491
491
  """
492
492
  ...
493
493
 
494
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
494
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
495
495
 
496
496
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
497
497
  """Return the inner Python object wrapped by this Modal Function."""