modal 1.1.5.dev66__py3-none-any.whl → 1.3.1.dev8__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.
- modal/__init__.py +4 -4
- modal/__main__.py +4 -29
- modal/_billing.py +84 -0
- modal/_clustered_functions.py +1 -3
- modal/_container_entrypoint.py +33 -208
- modal/_functions.py +171 -138
- modal/_grpc_client.py +191 -0
- modal/_ipython.py +16 -6
- modal/_load_context.py +106 -0
- modal/_object.py +72 -21
- modal/_output.py +12 -14
- modal/_partial_function.py +31 -4
- modal/_resolver.py +44 -57
- modal/_runtime/container_io_manager.py +30 -28
- modal/_runtime/container_io_manager.pyi +42 -44
- modal/_runtime/gpu_memory_snapshot.py +9 -7
- modal/_runtime/user_code_event_loop.py +80 -0
- modal/_runtime/user_code_imports.py +236 -10
- modal/_serialization.py +2 -1
- modal/_traceback.py +4 -13
- modal/_tunnel.py +16 -11
- modal/_tunnel.pyi +25 -3
- modal/_utils/async_utils.py +337 -10
- modal/_utils/auth_token_manager.py +1 -4
- modal/_utils/blob_utils.py +29 -22
- modal/_utils/function_utils.py +20 -21
- modal/_utils/grpc_testing.py +6 -3
- modal/_utils/grpc_utils.py +223 -64
- modal/_utils/mount_utils.py +26 -1
- modal/_utils/name_utils.py +2 -3
- modal/_utils/package_utils.py +0 -1
- modal/_utils/rand_pb_testing.py +8 -1
- modal/_utils/task_command_router_client.py +524 -0
- modal/_vendor/cloudpickle.py +144 -48
- modal/app.py +285 -105
- modal/app.pyi +216 -53
- modal/billing.py +5 -0
- modal/builder/2025.06.txt +6 -3
- modal/builder/PREVIEW.txt +2 -1
- modal/builder/base-images.json +4 -2
- modal/cli/_download.py +19 -3
- modal/cli/cluster.py +4 -2
- modal/cli/config.py +3 -1
- modal/cli/container.py +5 -4
- modal/cli/dict.py +5 -2
- modal/cli/entry_point.py +26 -2
- modal/cli/environment.py +2 -16
- modal/cli/launch.py +1 -76
- modal/cli/network_file_system.py +5 -20
- modal/cli/programs/run_jupyter.py +1 -1
- modal/cli/programs/vscode.py +1 -1
- modal/cli/queues.py +5 -4
- modal/cli/run.py +24 -204
- modal/cli/secret.py +1 -2
- modal/cli/shell.py +375 -0
- modal/cli/utils.py +1 -13
- modal/cli/volume.py +11 -17
- modal/client.py +16 -125
- modal/client.pyi +94 -144
- modal/cloud_bucket_mount.py +3 -1
- modal/cloud_bucket_mount.pyi +4 -0
- modal/cls.py +101 -64
- modal/cls.pyi +9 -8
- modal/config.py +21 -1
- modal/container_process.py +288 -12
- modal/container_process.pyi +99 -38
- modal/dict.py +72 -33
- modal/dict.pyi +88 -57
- modal/environments.py +16 -8
- modal/environments.pyi +6 -2
- modal/exception.py +154 -16
- modal/experimental/__init__.py +24 -53
- modal/experimental/flash.py +161 -74
- modal/experimental/flash.pyi +97 -49
- modal/file_io.py +50 -92
- modal/file_io.pyi +117 -89
- modal/functions.pyi +70 -87
- modal/image.py +82 -47
- modal/image.pyi +51 -30
- modal/io_streams.py +500 -149
- modal/io_streams.pyi +279 -189
- modal/mount.py +60 -46
- modal/mount.pyi +41 -17
- modal/network_file_system.py +19 -11
- modal/network_file_system.pyi +72 -39
- modal/object.pyi +114 -22
- modal/parallel_map.py +42 -44
- modal/parallel_map.pyi +9 -17
- modal/partial_function.pyi +4 -2
- modal/proxy.py +14 -6
- modal/proxy.pyi +10 -2
- modal/queue.py +45 -38
- modal/queue.pyi +88 -52
- modal/runner.py +96 -96
- modal/runner.pyi +44 -27
- modal/sandbox.py +225 -107
- modal/sandbox.pyi +226 -60
- modal/secret.py +58 -56
- modal/secret.pyi +28 -13
- modal/serving.py +7 -11
- modal/serving.pyi +7 -8
- modal/snapshot.py +29 -15
- modal/snapshot.pyi +18 -10
- modal/token_flow.py +1 -1
- modal/token_flow.pyi +4 -6
- modal/volume.py +102 -55
- modal/volume.pyi +125 -66
- {modal-1.1.5.dev66.dist-info → modal-1.3.1.dev8.dist-info}/METADATA +10 -9
- modal-1.3.1.dev8.dist-info/RECORD +189 -0
- modal_proto/api.proto +141 -70
- modal_proto/api_grpc.py +42 -26
- modal_proto/api_pb2.py +1123 -1103
- modal_proto/api_pb2.pyi +331 -83
- modal_proto/api_pb2_grpc.py +80 -48
- modal_proto/api_pb2_grpc.pyi +26 -18
- modal_proto/modal_api_grpc.py +175 -174
- modal_proto/task_command_router.proto +164 -0
- modal_proto/task_command_router_grpc.py +138 -0
- modal_proto/task_command_router_pb2.py +180 -0
- modal_proto/{sandbox_router_pb2.pyi → task_command_router_pb2.pyi} +148 -57
- modal_proto/task_command_router_pb2_grpc.py +272 -0
- modal_proto/task_command_router_pb2_grpc.pyi +100 -0
- modal_version/__init__.py +1 -1
- modal_version/__main__.py +1 -1
- modal/cli/programs/launch_instance_ssh.py +0 -94
- modal/cli/programs/run_marimo.py +0 -95
- modal-1.1.5.dev66.dist-info/RECORD +0 -191
- modal_proto/modal_options_grpc.py +0 -3
- modal_proto/options.proto +0 -19
- modal_proto/options_grpc.py +0 -3
- modal_proto/options_pb2.py +0 -35
- modal_proto/options_pb2.pyi +0 -20
- modal_proto/options_pb2_grpc.py +0 -4
- modal_proto/options_pb2_grpc.pyi +0 -7
- modal_proto/sandbox_router.proto +0 -125
- modal_proto/sandbox_router_grpc.py +0 -89
- modal_proto/sandbox_router_pb2.py +0 -128
- modal_proto/sandbox_router_pb2_grpc.py +0 -169
- modal_proto/sandbox_router_pb2_grpc.pyi +0 -63
- {modal-1.1.5.dev66.dist-info → modal-1.3.1.dev8.dist-info}/WHEEL +0 -0
- {modal-1.1.5.dev66.dist-info → modal-1.3.1.dev8.dist-info}/entry_points.txt +0 -0
- {modal-1.1.5.dev66.dist-info → modal-1.3.1.dev8.dist-info}/licenses/LICENSE +0 -0
- {modal-1.1.5.dev66.dist-info → modal-1.3.1.dev8.dist-info}/top_level.txt +0 -0
modal/functions.pyi
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import collections.abc
|
|
2
2
|
import google.protobuf.message
|
|
3
3
|
import modal._functions
|
|
4
|
+
import modal._load_context
|
|
4
5
|
import modal._utils.async_utils
|
|
5
6
|
import modal._utils.function_utils
|
|
6
7
|
import modal.app
|
|
@@ -17,7 +18,6 @@ import modal.parallel_map
|
|
|
17
18
|
import modal.proxy
|
|
18
19
|
import modal.retries
|
|
19
20
|
import modal.schedule
|
|
20
|
-
import modal.scheduler_placement
|
|
21
21
|
import modal.secret
|
|
22
22
|
import modal.volume
|
|
23
23
|
import modal_proto.api_pb2
|
|
@@ -25,8 +25,6 @@ import pathlib
|
|
|
25
25
|
import typing
|
|
26
26
|
import typing_extensions
|
|
27
27
|
|
|
28
|
-
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
|
29
|
-
|
|
30
28
|
ReturnType_INNER = typing.TypeVar("ReturnType_INNER", covariant=True)
|
|
31
29
|
|
|
32
30
|
P_INNER = typing_extensions.ParamSpec("P_INNER")
|
|
@@ -66,7 +64,7 @@ class Function(
|
|
|
66
64
|
@staticmethod
|
|
67
65
|
def from_local(
|
|
68
66
|
info: modal._utils.function_utils.FunctionInfo,
|
|
69
|
-
app,
|
|
67
|
+
app: typing.Optional[modal.app.App],
|
|
70
68
|
image: modal.image.Image,
|
|
71
69
|
env: typing.Optional[dict[str, typing.Optional[str]]] = None,
|
|
72
70
|
secrets: typing.Optional[collections.abc.Collection[modal.secret.Secret]] = None,
|
|
@@ -96,7 +94,8 @@ class Function(
|
|
|
96
94
|
batch_max_size: typing.Optional[int] = None,
|
|
97
95
|
batch_wait_ms: typing.Optional[int] = None,
|
|
98
96
|
cloud: typing.Optional[str] = None,
|
|
99
|
-
|
|
97
|
+
region: typing.Union[str, collections.abc.Sequence[str], None] = None,
|
|
98
|
+
nonpreemptible: bool = False,
|
|
100
99
|
is_builder_function: bool = False,
|
|
101
100
|
is_auto_snapshot: bool = False,
|
|
102
101
|
enable_memory_snapshot: bool = False,
|
|
@@ -105,13 +104,14 @@ class Function(
|
|
|
105
104
|
i6pn_enabled: bool = False,
|
|
106
105
|
cluster_size: typing.Optional[int] = None,
|
|
107
106
|
rdma: typing.Optional[bool] = None,
|
|
108
|
-
|
|
107
|
+
single_use_containers: bool = False,
|
|
109
108
|
ephemeral_disk: typing.Optional[int] = None,
|
|
110
109
|
include_source: bool = True,
|
|
111
110
|
experimental_options: typing.Optional[dict[str, str]] = None,
|
|
112
111
|
_experimental_proxy_ip: typing.Optional[str] = None,
|
|
113
112
|
_experimental_custom_scaling_factor: typing.Optional[float] = None,
|
|
114
113
|
restrict_output: bool = False,
|
|
114
|
+
http_config: typing.Optional[modal_proto.api_pb2.HTTPConfig] = None,
|
|
115
115
|
) -> Function:
|
|
116
116
|
"""mdmd:hidden
|
|
117
117
|
|
|
@@ -132,7 +132,7 @@ class Function(
|
|
|
132
132
|
"""
|
|
133
133
|
...
|
|
134
134
|
|
|
135
|
-
class __update_autoscaler_spec(typing_extensions.Protocol
|
|
135
|
+
class __update_autoscaler_spec(typing_extensions.Protocol):
|
|
136
136
|
def __call__(
|
|
137
137
|
self,
|
|
138
138
|
/,
|
|
@@ -203,9 +203,9 @@ class Function(
|
|
|
203
203
|
"""
|
|
204
204
|
...
|
|
205
205
|
|
|
206
|
-
update_autoscaler: __update_autoscaler_spec
|
|
206
|
+
update_autoscaler: __update_autoscaler_spec
|
|
207
207
|
|
|
208
|
-
class __keep_warm_spec(typing_extensions.Protocol
|
|
208
|
+
class __keep_warm_spec(typing_extensions.Protocol):
|
|
209
209
|
def __call__(self, /, warm_pool_size: int) -> None:
|
|
210
210
|
"""mdmd:hidden
|
|
211
211
|
Set the warm pool size for the Function.
|
|
@@ -242,13 +242,19 @@ class Function(
|
|
|
242
242
|
"""
|
|
243
243
|
...
|
|
244
244
|
|
|
245
|
-
keep_warm: __keep_warm_spec
|
|
245
|
+
keep_warm: __keep_warm_spec
|
|
246
246
|
|
|
247
247
|
@classmethod
|
|
248
|
-
def _from_name(cls, app_name: str, name: str,
|
|
248
|
+
def _from_name(cls, app_name: str, name: str, *, load_context_overrides: modal._load_context.LoadContext): ...
|
|
249
249
|
@classmethod
|
|
250
250
|
def from_name(
|
|
251
|
-
cls: type[Function],
|
|
251
|
+
cls: type[Function],
|
|
252
|
+
app_name: str,
|
|
253
|
+
name: str,
|
|
254
|
+
*,
|
|
255
|
+
namespace=None,
|
|
256
|
+
environment_name: typing.Optional[str] = None,
|
|
257
|
+
client: typing.Optional[modal.client.Client] = None,
|
|
252
258
|
) -> Function:
|
|
253
259
|
"""Reference a Function from a deployed App by its name.
|
|
254
260
|
|
|
@@ -305,7 +311,7 @@ class Function(
|
|
|
305
311
|
"""
|
|
306
312
|
...
|
|
307
313
|
|
|
308
|
-
class __get_web_url_spec(typing_extensions.Protocol
|
|
314
|
+
class __get_web_url_spec(typing_extensions.Protocol):
|
|
309
315
|
def __call__(self, /) -> typing.Optional[str]:
|
|
310
316
|
"""URL of a Function running as a web endpoint."""
|
|
311
317
|
...
|
|
@@ -314,9 +320,9 @@ class Function(
|
|
|
314
320
|
"""URL of a Function running as a web endpoint."""
|
|
315
321
|
...
|
|
316
322
|
|
|
317
|
-
get_web_url: __get_web_url_spec
|
|
323
|
+
get_web_url: __get_web_url_spec
|
|
318
324
|
|
|
319
|
-
class ___experimental_get_flash_urls_spec(typing_extensions.Protocol
|
|
325
|
+
class ___experimental_get_flash_urls_spec(typing_extensions.Protocol):
|
|
320
326
|
def __call__(self, /) -> typing.Optional[list[str]]:
|
|
321
327
|
"""URL of the flash service for the function."""
|
|
322
328
|
...
|
|
@@ -325,14 +331,14 @@ class Function(
|
|
|
325
331
|
"""URL of the flash service for the function."""
|
|
326
332
|
...
|
|
327
333
|
|
|
328
|
-
_experimental_get_flash_urls: ___experimental_get_flash_urls_spec
|
|
334
|
+
_experimental_get_flash_urls: ___experimental_get_flash_urls_spec
|
|
329
335
|
|
|
330
336
|
@property
|
|
331
337
|
def is_generator(self) -> bool:
|
|
332
338
|
"""mdmd:hidden"""
|
|
333
339
|
...
|
|
334
340
|
|
|
335
|
-
class ___map_spec(typing_extensions.Protocol
|
|
341
|
+
class ___map_spec(typing_extensions.Protocol):
|
|
336
342
|
def __call__(
|
|
337
343
|
self,
|
|
338
344
|
/,
|
|
@@ -371,21 +377,21 @@ class Function(
|
|
|
371
377
|
"""
|
|
372
378
|
...
|
|
373
379
|
|
|
374
|
-
_map: ___map_spec
|
|
380
|
+
_map: ___map_spec
|
|
375
381
|
|
|
376
|
-
class ___spawn_map_spec(typing_extensions.Protocol[ReturnType_INNER
|
|
382
|
+
class ___spawn_map_spec(typing_extensions.Protocol[ReturnType_INNER]):
|
|
377
383
|
def __call__(self, /, input_queue: modal.parallel_map.SynchronizedQueue) -> FunctionCall[ReturnType_INNER]: ...
|
|
378
384
|
async def aio(self, /, input_queue: modal.parallel_map.SynchronizedQueue) -> FunctionCall[ReturnType_INNER]: ...
|
|
379
385
|
|
|
380
|
-
_spawn_map: ___spawn_map_spec[modal._functions.ReturnType
|
|
386
|
+
_spawn_map: ___spawn_map_spec[modal._functions.ReturnType]
|
|
381
387
|
|
|
382
|
-
class ___call_function_spec(typing_extensions.Protocol[ReturnType_INNER
|
|
388
|
+
class ___call_function_spec(typing_extensions.Protocol[ReturnType_INNER]):
|
|
383
389
|
def __call__(self, /, args, kwargs) -> ReturnType_INNER: ...
|
|
384
390
|
async def aio(self, /, args, kwargs) -> ReturnType_INNER: ...
|
|
385
391
|
|
|
386
|
-
_call_function: ___call_function_spec[modal._functions.ReturnType
|
|
392
|
+
_call_function: ___call_function_spec[modal._functions.ReturnType]
|
|
387
393
|
|
|
388
|
-
class ___call_function_nowait_spec(typing_extensions.Protocol
|
|
394
|
+
class ___call_function_nowait_spec(typing_extensions.Protocol):
|
|
389
395
|
def __call__(
|
|
390
396
|
self, /, args, kwargs, function_call_invocation_type: int, from_spawn_map: bool = False
|
|
391
397
|
) -> modal._functions._Invocation: ...
|
|
@@ -393,15 +399,15 @@ class Function(
|
|
|
393
399
|
self, /, args, kwargs, function_call_invocation_type: int, from_spawn_map: bool = False
|
|
394
400
|
) -> modal._functions._Invocation: ...
|
|
395
401
|
|
|
396
|
-
_call_function_nowait: ___call_function_nowait_spec
|
|
402
|
+
_call_function_nowait: ___call_function_nowait_spec
|
|
397
403
|
|
|
398
|
-
class ___call_generator_spec(typing_extensions.Protocol
|
|
404
|
+
class ___call_generator_spec(typing_extensions.Protocol):
|
|
399
405
|
def __call__(self, /, args, kwargs): ...
|
|
400
406
|
def aio(self, /, args, kwargs): ...
|
|
401
407
|
|
|
402
|
-
_call_generator: ___call_generator_spec
|
|
408
|
+
_call_generator: ___call_generator_spec
|
|
403
409
|
|
|
404
|
-
class __remote_spec(typing_extensions.Protocol[
|
|
410
|
+
class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
|
405
411
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
|
|
406
412
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
407
413
|
...
|
|
@@ -410,9 +416,9 @@ class Function(
|
|
|
410
416
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
411
417
|
...
|
|
412
418
|
|
|
413
|
-
remote: __remote_spec[modal._functions.
|
|
419
|
+
remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
|
|
414
420
|
|
|
415
|
-
class __remote_gen_spec(typing_extensions.Protocol
|
|
421
|
+
class __remote_gen_spec(typing_extensions.Protocol):
|
|
416
422
|
def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
|
|
417
423
|
"""Calls the generator remotely, executing it with the given arguments and returning the execution's result."""
|
|
418
424
|
...
|
|
@@ -421,7 +427,7 @@ class Function(
|
|
|
421
427
|
"""Calls the generator remotely, executing it with the given arguments and returning the execution's result."""
|
|
422
428
|
...
|
|
423
429
|
|
|
424
|
-
remote_gen: __remote_gen_spec
|
|
430
|
+
remote_gen: __remote_gen_spec
|
|
425
431
|
|
|
426
432
|
def _is_local(self): ...
|
|
427
433
|
def _get_info(self) -> modal._utils.function_utils.FunctionInfo: ...
|
|
@@ -437,7 +443,7 @@ class Function(
|
|
|
437
443
|
"""
|
|
438
444
|
...
|
|
439
445
|
|
|
440
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
|
446
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
|
441
447
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
442
448
|
"""[Experimental] Calls the function with the given arguments, without waiting for the results.
|
|
443
449
|
|
|
@@ -460,17 +466,15 @@ class Function(
|
|
|
460
466
|
"""
|
|
461
467
|
...
|
|
462
468
|
|
|
463
|
-
_experimental_spawn: ___experimental_spawn_spec[
|
|
464
|
-
modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
|
|
465
|
-
]
|
|
469
|
+
_experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
|
|
466
470
|
|
|
467
|
-
class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER
|
|
471
|
+
class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
|
|
468
472
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
|
|
469
473
|
async def aio(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
|
|
470
474
|
|
|
471
|
-
_spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P
|
|
475
|
+
_spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
|
|
472
476
|
|
|
473
|
-
class __spawn_spec(typing_extensions.Protocol[
|
|
477
|
+
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
|
|
474
478
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
475
479
|
"""Calls the function with the given arguments, without waiting for the results.
|
|
476
480
|
|
|
@@ -491,13 +495,13 @@ class Function(
|
|
|
491
495
|
"""
|
|
492
496
|
...
|
|
493
497
|
|
|
494
|
-
spawn: __spawn_spec[modal._functions.
|
|
498
|
+
spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
|
|
495
499
|
|
|
496
500
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
|
|
497
501
|
"""Return the inner Python object wrapped by this Modal Function."""
|
|
498
502
|
...
|
|
499
503
|
|
|
500
|
-
class __get_current_stats_spec(typing_extensions.Protocol
|
|
504
|
+
class __get_current_stats_spec(typing_extensions.Protocol):
|
|
501
505
|
def __call__(self, /) -> modal._functions.FunctionStats:
|
|
502
506
|
"""Return a `FunctionStats` object describing the current function's queue and runner counts."""
|
|
503
507
|
...
|
|
@@ -506,9 +510,9 @@ class Function(
|
|
|
506
510
|
"""Return a `FunctionStats` object describing the current function's queue and runner counts."""
|
|
507
511
|
...
|
|
508
512
|
|
|
509
|
-
get_current_stats: __get_current_stats_spec
|
|
513
|
+
get_current_stats: __get_current_stats_spec
|
|
510
514
|
|
|
511
|
-
class ___get_schema_spec(typing_extensions.Protocol
|
|
515
|
+
class ___get_schema_spec(typing_extensions.Protocol):
|
|
512
516
|
def __call__(self, /) -> modal_proto.api_pb2.FunctionSchema:
|
|
513
517
|
"""Returns recorded schema for function, internal use only for now"""
|
|
514
518
|
...
|
|
@@ -517,9 +521,9 @@ class Function(
|
|
|
517
521
|
"""Returns recorded schema for function, internal use only for now"""
|
|
518
522
|
...
|
|
519
523
|
|
|
520
|
-
_get_schema: ___get_schema_spec
|
|
524
|
+
_get_schema: ___get_schema_spec
|
|
521
525
|
|
|
522
|
-
class __map_spec(typing_extensions.Protocol
|
|
526
|
+
class __map_spec(typing_extensions.Protocol):
|
|
523
527
|
def __call__(
|
|
524
528
|
self,
|
|
525
529
|
/,
|
|
@@ -577,9 +581,9 @@ class Function(
|
|
|
577
581
|
wrap_returned_exceptions: bool = True,
|
|
578
582
|
) -> typing.AsyncGenerator[typing.Any, None]: ...
|
|
579
583
|
|
|
580
|
-
map: __map_spec
|
|
584
|
+
map: __map_spec
|
|
581
585
|
|
|
582
|
-
class __starmap_spec(typing_extensions.Protocol
|
|
586
|
+
class __starmap_spec(typing_extensions.Protocol):
|
|
583
587
|
def __call__(
|
|
584
588
|
self,
|
|
585
589
|
/,
|
|
@@ -621,9 +625,9 @@ class Function(
|
|
|
621
625
|
wrap_returned_exceptions: bool = True,
|
|
622
626
|
) -> typing.AsyncIterable[typing.Any]: ...
|
|
623
627
|
|
|
624
|
-
starmap: __starmap_spec
|
|
628
|
+
starmap: __starmap_spec
|
|
625
629
|
|
|
626
|
-
class __for_each_spec(typing_extensions.Protocol
|
|
630
|
+
class __for_each_spec(typing_extensions.Protocol):
|
|
627
631
|
def __call__(self, /, *input_iterators, kwargs={}, ignore_exceptions: bool = False):
|
|
628
632
|
"""Execute function for all inputs, ignoring outputs. Waits for completion of the inputs.
|
|
629
633
|
|
|
@@ -634,9 +638,9 @@ class Function(
|
|
|
634
638
|
|
|
635
639
|
async def aio(self, /, *input_iterators, kwargs={}, ignore_exceptions: bool = False) -> None: ...
|
|
636
640
|
|
|
637
|
-
for_each: __for_each_spec
|
|
641
|
+
for_each: __for_each_spec
|
|
638
642
|
|
|
639
|
-
class __spawn_map_spec(typing_extensions.Protocol
|
|
643
|
+
class __spawn_map_spec(typing_extensions.Protocol):
|
|
640
644
|
def __call__(self, /, *input_iterators, kwargs={}) -> None:
|
|
641
645
|
"""Spawn parallel execution over a set of inputs, exiting as soon as the inputs are created (without waiting
|
|
642
646
|
for the map to complete).
|
|
@@ -665,9 +669,9 @@ class Function(
|
|
|
665
669
|
"""
|
|
666
670
|
...
|
|
667
671
|
|
|
668
|
-
spawn_map: __spawn_map_spec
|
|
672
|
+
spawn_map: __spawn_map_spec
|
|
669
673
|
|
|
670
|
-
class __experimental_spawn_map_spec(typing_extensions.Protocol
|
|
674
|
+
class __experimental_spawn_map_spec(typing_extensions.Protocol):
|
|
671
675
|
def __call__(self, /, *input_iterators, kwargs={}) -> modal._functions._FunctionCall:
|
|
672
676
|
"""mdmd:hidden
|
|
673
677
|
Spawn parallel execution over a set of inputs, returning as soon as the inputs are created.
|
|
@@ -693,7 +697,7 @@ class Function(
|
|
|
693
697
|
|
|
694
698
|
async def aio(self, /, *input_iterators, kwargs={}) -> modal._functions._FunctionCall: ...
|
|
695
699
|
|
|
696
|
-
experimental_spawn_map: __experimental_spawn_map_spec
|
|
700
|
+
experimental_spawn_map: __experimental_spawn_map_spec
|
|
697
701
|
|
|
698
702
|
class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Object):
|
|
699
703
|
"""A reference to an executed function call.
|
|
@@ -714,9 +718,8 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
714
718
|
...
|
|
715
719
|
|
|
716
720
|
def _invocation(self): ...
|
|
717
|
-
def _hydrate_metadata(self, metadata: typing.Optional[google.protobuf.message.Message]): ...
|
|
718
721
|
|
|
719
|
-
class __num_inputs_spec(typing_extensions.Protocol
|
|
722
|
+
class __num_inputs_spec(typing_extensions.Protocol):
|
|
720
723
|
def __call__(self, /) -> int:
|
|
721
724
|
"""Get the number of inputs in the function call."""
|
|
722
725
|
...
|
|
@@ -725,9 +728,9 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
725
728
|
"""Get the number of inputs in the function call."""
|
|
726
729
|
...
|
|
727
730
|
|
|
728
|
-
num_inputs: __num_inputs_spec
|
|
731
|
+
num_inputs: __num_inputs_spec
|
|
729
732
|
|
|
730
|
-
class __get_spec(typing_extensions.Protocol[ReturnType_INNER
|
|
733
|
+
class __get_spec(typing_extensions.Protocol[ReturnType_INNER]):
|
|
731
734
|
def __call__(self, /, timeout: typing.Optional[float] = None, *, index: int = 0) -> ReturnType_INNER:
|
|
732
735
|
"""Get the result of the index-th input of the function call.
|
|
733
736
|
`.spawn()` calls have a single output, so only specifying `index=0` is valid.
|
|
@@ -754,9 +757,9 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
754
757
|
"""
|
|
755
758
|
...
|
|
756
759
|
|
|
757
|
-
get: __get_spec[modal._functions.ReturnType
|
|
760
|
+
get: __get_spec[modal._functions.ReturnType]
|
|
758
761
|
|
|
759
|
-
class __iter_spec(typing_extensions.Protocol[ReturnType_INNER
|
|
762
|
+
class __iter_spec(typing_extensions.Protocol[ReturnType_INNER]):
|
|
760
763
|
def __call__(self, /, *, start: int = 0, end: typing.Optional[int] = None) -> typing.Iterator[ReturnType_INNER]:
|
|
761
764
|
"""Iterate in-order over the results of the function call.
|
|
762
765
|
|
|
@@ -803,9 +806,9 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
803
806
|
"""
|
|
804
807
|
...
|
|
805
808
|
|
|
806
|
-
iter: __iter_spec[modal._functions.ReturnType
|
|
809
|
+
iter: __iter_spec[modal._functions.ReturnType]
|
|
807
810
|
|
|
808
|
-
class __get_call_graph_spec(typing_extensions.Protocol
|
|
811
|
+
class __get_call_graph_spec(typing_extensions.Protocol):
|
|
809
812
|
def __call__(self, /) -> list[modal.call_graph.InputInfo]:
|
|
810
813
|
"""Returns a structure representing the call graph from a given root
|
|
811
814
|
call ID, along with the status of execution for each node.
|
|
@@ -824,9 +827,9 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
824
827
|
"""
|
|
825
828
|
...
|
|
826
829
|
|
|
827
|
-
get_call_graph: __get_call_graph_spec
|
|
830
|
+
get_call_graph: __get_call_graph_spec
|
|
828
831
|
|
|
829
|
-
class __cancel_spec(typing_extensions.Protocol
|
|
832
|
+
class __cancel_spec(typing_extensions.Protocol):
|
|
830
833
|
def __call__(self, /, terminate_containers: bool = False):
|
|
831
834
|
"""Cancels the function call, which will stop its execution and mark its inputs as
|
|
832
835
|
[`TERMINATED`](https://modal.com/docs/reference/modal.call_graph#modalcall_graphinputstatus).
|
|
@@ -845,7 +848,7 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
845
848
|
"""
|
|
846
849
|
...
|
|
847
850
|
|
|
848
|
-
cancel: __cancel_spec
|
|
851
|
+
cancel: __cancel_spec
|
|
849
852
|
|
|
850
853
|
class __from_id_spec(typing_extensions.Protocol):
|
|
851
854
|
def __call__(
|
|
@@ -861,7 +864,7 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
861
864
|
fc_id = fc.object_id
|
|
862
865
|
|
|
863
866
|
# Later, use the ID to re-instantiate the FunctionCall object
|
|
864
|
-
fc =
|
|
867
|
+
fc = FunctionCall.from_id(fc_id)
|
|
865
868
|
result = fc.get()
|
|
866
869
|
```
|
|
867
870
|
|
|
@@ -870,29 +873,9 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
870
873
|
"""
|
|
871
874
|
...
|
|
872
875
|
|
|
873
|
-
async def aio(
|
|
874
|
-
self, /, function_call_id: str, client: typing.Optional[modal.client.Client] = None
|
|
875
|
-
) -> FunctionCall[typing.Any]:
|
|
876
|
-
"""Instantiate a FunctionCall object from an existing ID.
|
|
877
|
-
|
|
878
|
-
Examples:
|
|
879
|
-
|
|
880
|
-
```python notest
|
|
881
|
-
# Spawn a FunctionCall and keep track of its object ID
|
|
882
|
-
fc = my_func.spawn()
|
|
883
|
-
fc_id = fc.object_id
|
|
884
|
-
|
|
885
|
-
# Later, use the ID to re-instantiate the FunctionCall object
|
|
886
|
-
fc = _FunctionCall.from_id(fc_id)
|
|
887
|
-
result = fc.get()
|
|
888
|
-
```
|
|
889
|
-
|
|
890
|
-
Note that it's only necessary to re-instantiate the `FunctionCall` with this method
|
|
891
|
-
if you no longer have access to the original object returned from `Function.spawn`.
|
|
892
|
-
"""
|
|
893
|
-
...
|
|
876
|
+
async def aio(self, /, function_call_id: str, client: typing.Optional[modal.client.Client] = None): ...
|
|
894
877
|
|
|
895
|
-
from_id: __from_id_spec
|
|
878
|
+
from_id: typing.ClassVar[__from_id_spec]
|
|
896
879
|
|
|
897
880
|
class __gather_spec(typing_extensions.Protocol):
|
|
898
881
|
def __call__(self, /, *function_calls: FunctionCall[modal._functions.T]) -> typing.Sequence[modal._functions.T]:
|
|
@@ -939,7 +922,7 @@ class FunctionCall(typing.Generic[modal._functions.ReturnType], modal.object.Obj
|
|
|
939
922
|
"""
|
|
940
923
|
...
|
|
941
924
|
|
|
942
|
-
gather: __gather_spec
|
|
925
|
+
gather: typing.ClassVar[__gather_spec]
|
|
943
926
|
|
|
944
927
|
class __gather_spec(typing_extensions.Protocol):
|
|
945
928
|
def __call__(self, /, *function_calls) -> typing.Sequence[modal._functions.T]:
|