modAL 1.0.5__tar.gz → 1.0.5.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.
- {modal-1.0.5 → modal-1.0.5.dev2}/PKG-INFO +2 -2
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_clustered_functions.pyi +3 -13
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_functions.py +12 -41
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_partial_function.py +1 -1
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/container_io_manager.pyi +40 -222
- modal-1.0.5.dev2/modal/_runtime/execution_context.pyi +24 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_serialization.py +2 -25
- modal-1.0.5.dev2/modal/_tunnel.pyi +37 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/blob_utils.py +19 -56
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/function_utils.py +4 -30
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/grpc_utils.py +4 -11
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/app.py +5 -5
- modal-1.0.5.dev2/modal/app.pyi +510 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/run.py +1 -2
- modal-1.0.5.dev2/modal/client.pyi +223 -0
- modal-1.0.5.dev2/modal/cloud_bucket_mount.pyi +51 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cls.py +7 -7
- modal-1.0.5.dev2/modal/cls.pyi +308 -0
- modal-1.0.5.dev2/modal/container_process.pyi +86 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/dict.py +4 -4
- modal-1.0.5.dev2/modal/dict.pyi +209 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/environments.pyi +9 -41
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/exception.py +2 -2
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/experimental/__init__.py +0 -90
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/experimental/ipython.py +7 -11
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/file_io.pyi +45 -236
- modal-1.0.5.dev2/modal/functions.pyi +401 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/gpu.py +1 -1
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/image.py +1 -1
- modal-1.0.5.dev2/modal/image.pyi +610 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/io_streams.py +4 -8
- modal-1.0.5.dev2/modal/io_streams.pyi +124 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/mount.pyi +31 -261
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/network_file_system.py +3 -3
- modal-1.0.5.dev2/modal/network_file_system.pyi +222 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/object.pyi +9 -48
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/parallel_map.py +3 -42
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/parallel_map.pyi +14 -149
- modal-1.0.5.dev2/modal/partial_function.pyi +172 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/proxy.py +1 -1
- modal-1.0.5.dev2/modal/proxy.pyi +12 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/queue.py +4 -4
- modal-1.0.5.dev2/modal/queue.pyi +300 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/runner.pyi +22 -160
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/sandbox.py +7 -8
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/sandbox.pyi +50 -310
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/schedule.py +1 -1
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/secret.py +2 -2
- modal-1.0.5.dev2/modal/secret.pyi +93 -0
- modal-1.0.5.dev2/modal/snapshot.pyi +18 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/token_flow.pyi +8 -28
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/volume.py +4 -41
- modal-1.0.5.dev2/modal/volume.pyi +537 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/PKG-INFO +2 -2
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/requires.txt +1 -1
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api.proto +0 -56
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api_grpc.py +0 -48
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api_pb2.py +780 -874
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api_pb2.pyi +8 -194
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api_pb2_grpc.py +0 -100
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/api_pb2_grpc.pyi +0 -32
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/modal_api_grpc.py +0 -3
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_version/__init__.py +1 -1
- {modal-1.0.5 → modal-1.0.5.dev2}/pyproject.toml +1 -1
- modal-1.0.5/modal/_runtime/execution_context.pyi +0 -78
- modal-1.0.5/modal/_tunnel.pyi +0 -405
- modal-1.0.5/modal/app.pyi +0 -1120
- modal-1.0.5/modal/client.pyi +0 -411
- modal-1.0.5/modal/cloud_bucket_mount.pyi +0 -239
- modal-1.0.5/modal/cls.pyi +0 -715
- modal-1.0.5/modal/container_process.pyi +0 -175
- modal-1.0.5/modal/dict.pyi +0 -611
- modal-1.0.5/modal/functions.pyi +0 -890
- modal-1.0.5/modal/image.pyi +0 -1792
- modal-1.0.5/modal/io_streams.pyi +0 -434
- modal-1.0.5/modal/network_file_system.pyi +0 -503
- modal-1.0.5/modal/partial_function.pyi +0 -413
- modal-1.0.5/modal/proxy.pyi +0 -37
- modal-1.0.5/modal/queue.pyi +0 -717
- modal-1.0.5/modal/secret.pyi +0 -242
- modal-1.0.5/modal/snapshot.pyi +0 -39
- modal-1.0.5/modal/volume.pyi +0 -1171
- {modal-1.0.5 → modal-1.0.5.dev2}/LICENSE +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/README.md +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/__main__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_clustered_functions.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_container_entrypoint.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_ipython.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_location.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_object.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_output.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_pty.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_resolver.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_resources.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/asgi.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/container_io_manager.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/execution_context.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/gpu_memory_snapshot.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/telemetry.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_runtime/user_code_imports.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_traceback.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_tunnel.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_type_manager.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/app_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/async_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/bytes_io_segment_payload.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/deprecation.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/docker_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/git_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/grpc_testing.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/hash_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/http_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/jwt_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/logger.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/mount_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/name_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/package_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/pattern_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/rand_pb_testing.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/shell_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_utils/time_utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_vendor/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_vendor/a2wsgi_wsgi.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_vendor/cloudpickle.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_vendor/tblib.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/_watcher.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/call_graph.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/_download.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/_traceback.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/app.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/cluster.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/config.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/container.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/dict.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/entry_point.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/environment.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/import_refs.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/launch.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/network_file_system.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/profile.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/programs/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/programs/run_jupyter.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/programs/vscode.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/queues.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/secret.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/token.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/utils.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cli/volume.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/client.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/cloud_bucket_mount.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/config.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/container_process.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/environments.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/file_io.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/file_pattern_matcher.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/functions.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/mount.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/object.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/output.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/partial_function.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/py.typed +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/2023.12.312.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/2023.12.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/2024.04.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/2024.10.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/PREVIEW.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/README.md +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/requirements/base-images.json +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/retries.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/runner.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/running_app.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/scheduler_placement.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/serving.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/serving.pyi +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/snapshot.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/stream_type.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal/token_flow.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/SOURCES.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/dependency_links.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/entry_points.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal.egg-info/top_level.txt +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/gen_cli_docs.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/gen_reference_docs.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/mdmd/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/mdmd/mdmd.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_docs/mdmd/signatures.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/__init__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/modal_options_grpc.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options.proto +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options_grpc.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options_pb2.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options_pb2.pyi +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options_pb2_grpc.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/options_pb2_grpc.pyi +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_proto/py.typed +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/modal_version/__main__.py +0 -0
- {modal-1.0.5 → modal-1.0.5.dev2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modal
|
|
3
|
-
Version: 1.0.5
|
|
3
|
+
Version: 1.0.5.dev2
|
|
4
4
|
Summary: Python client library for Modal
|
|
5
5
|
Author-email: Modal Labs <support@modal.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,7 +19,7 @@ License-File: LICENSE
|
|
|
19
19
|
Requires-Dist: aiohttp
|
|
20
20
|
Requires-Dist: certifi
|
|
21
21
|
Requires-Dist: click~=8.1.0
|
|
22
|
-
Requires-Dist: grpclib
|
|
22
|
+
Requires-Dist: grpclib==0.4.7
|
|
23
23
|
Requires-Dist: protobuf!=4.24.0,<7.0,>=3.19
|
|
24
24
|
Requires-Dist: rich>=12.0.0
|
|
25
25
|
Requires-Dist: synchronicity~=0.9.15
|
|
@@ -3,22 +3,12 @@ import typing
|
|
|
3
3
|
import typing_extensions
|
|
4
4
|
|
|
5
5
|
class ClusterInfo:
|
|
6
|
-
"""ClusterInfo(rank: int, container_ips: list[str])"""
|
|
7
|
-
|
|
8
6
|
rank: int
|
|
9
7
|
container_ips: list[str]
|
|
10
8
|
|
|
11
|
-
def __init__(self, rank: int, container_ips: list[str]) -> None:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def __repr__(self):
|
|
16
|
-
"""Return repr(self)."""
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
def __eq__(self, other):
|
|
20
|
-
"""Return self==value."""
|
|
21
|
-
...
|
|
9
|
+
def __init__(self, rank: int, container_ips: list[str]) -> None: ...
|
|
10
|
+
def __repr__(self): ...
|
|
11
|
+
def __eq__(self, other): ...
|
|
22
12
|
|
|
23
13
|
def get_cluster_info() -> ClusterInfo: ...
|
|
24
14
|
async def _initialize_clustered_function(client: modal.client._Client, task_id: str, world_size: int): ...
|
|
@@ -141,13 +141,7 @@ class _Invocation:
|
|
|
141
141
|
stub = client.stub
|
|
142
142
|
|
|
143
143
|
function_id = function.object_id
|
|
144
|
-
item = await _create_input(
|
|
145
|
-
args,
|
|
146
|
-
kwargs,
|
|
147
|
-
stub,
|
|
148
|
-
method_name=function._use_method_name,
|
|
149
|
-
function_call_invocation_type=function_call_invocation_type,
|
|
150
|
-
)
|
|
144
|
+
item = await _create_input(args, kwargs, stub, method_name=function._use_method_name)
|
|
151
145
|
|
|
152
146
|
request = api_pb2.FunctionMapRequest(
|
|
153
147
|
function_id=function_id,
|
|
@@ -362,14 +356,12 @@ class _InputPlaneInvocation:
|
|
|
362
356
|
client: _Client,
|
|
363
357
|
input_item: api_pb2.FunctionPutInputsItem,
|
|
364
358
|
function_id: str,
|
|
365
|
-
input_plane_region: str,
|
|
366
359
|
):
|
|
367
360
|
self.stub = stub
|
|
368
361
|
self.client = client # Used by the deserializer.
|
|
369
362
|
self.attempt_token = attempt_token
|
|
370
363
|
self.input_item = input_item
|
|
371
364
|
self.function_id = function_id
|
|
372
|
-
self.input_plane_region = input_plane_region
|
|
373
365
|
|
|
374
366
|
@staticmethod
|
|
375
367
|
async def create(
|
|
@@ -379,27 +371,21 @@ class _InputPlaneInvocation:
|
|
|
379
371
|
*,
|
|
380
372
|
client: _Client,
|
|
381
373
|
input_plane_url: str,
|
|
382
|
-
input_plane_region: str,
|
|
383
374
|
) -> "_InputPlaneInvocation":
|
|
384
375
|
stub = await client.get_stub(input_plane_url)
|
|
385
376
|
|
|
386
377
|
function_id = function.object_id
|
|
387
|
-
|
|
388
|
-
# Note: Blob upload is done on the control plane stub, not the input plane stub!
|
|
389
|
-
input_item = await _create_input(args, kwargs, control_plane_stub, method_name=function._use_method_name)
|
|
378
|
+
input_item = await _create_input(args, kwargs, stub, method_name=function._use_method_name)
|
|
390
379
|
|
|
391
380
|
request = api_pb2.AttemptStartRequest(
|
|
392
381
|
function_id=function_id,
|
|
393
382
|
parent_input_id=current_input_id() or "",
|
|
394
383
|
input=input_item,
|
|
395
384
|
)
|
|
396
|
-
|
|
397
|
-
if input_plane_region and input_plane_region != "":
|
|
398
|
-
metadata.append(("x-modal-input-plane-region", input_plane_region))
|
|
399
|
-
response = await retry_transient_errors(stub.AttemptStart, request, metadata=metadata)
|
|
385
|
+
response = await retry_transient_errors(stub.AttemptStart, request)
|
|
400
386
|
attempt_token = response.attempt_token
|
|
401
387
|
|
|
402
|
-
return _InputPlaneInvocation(stub, attempt_token, client, input_item, function_id
|
|
388
|
+
return _InputPlaneInvocation(stub, attempt_token, client, input_item, function_id)
|
|
403
389
|
|
|
404
390
|
async def run_function(self) -> Any:
|
|
405
391
|
# This will retry when the server returns GENERIC_STATUS_INTERNAL_FAILURE, i.e. lost inputs or worker preemption
|
|
@@ -411,14 +397,10 @@ class _InputPlaneInvocation:
|
|
|
411
397
|
timeout_secs=OUTPUTS_TIMEOUT,
|
|
412
398
|
requested_at=time.time(),
|
|
413
399
|
)
|
|
414
|
-
metadata: list[tuple[str, str]] = []
|
|
415
|
-
if self.input_plane_region and self.input_plane_region != "":
|
|
416
|
-
metadata.append(("x-modal-input-plane-region", self.input_plane_region))
|
|
417
400
|
await_response: api_pb2.AttemptAwaitResponse = await retry_transient_errors(
|
|
418
401
|
self.stub.AttemptAwait,
|
|
419
402
|
await_request,
|
|
420
403
|
attempt_timeout=OUTPUTS_TIMEOUT + ATTEMPT_TIMEOUT_GRACE_PERIOD,
|
|
421
|
-
metadata=metadata,
|
|
422
404
|
)
|
|
423
405
|
|
|
424
406
|
if await_response.HasField("output"):
|
|
@@ -435,11 +417,7 @@ class _InputPlaneInvocation:
|
|
|
435
417
|
attempt_token=self.attempt_token,
|
|
436
418
|
)
|
|
437
419
|
# TODO(ryan): Add exponential backoff?
|
|
438
|
-
retry_response = await retry_transient_errors(
|
|
439
|
-
self.stub.AttemptRetry,
|
|
440
|
-
retry_request,
|
|
441
|
-
metadata=metadata,
|
|
442
|
-
)
|
|
420
|
+
retry_response = await retry_transient_errors(self.stub.AttemptRetry, retry_request)
|
|
443
421
|
self.attempt_token = retry_response.attempt_token
|
|
444
422
|
continue
|
|
445
423
|
|
|
@@ -799,7 +777,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
799
777
|
req.method_definitions[method_name].CopyFrom(method_definition)
|
|
800
778
|
elif webhook_config:
|
|
801
779
|
req.webhook_config.CopyFrom(webhook_config)
|
|
802
|
-
|
|
803
780
|
response = await retry_transient_errors(resolver.client.stub.FunctionPrecreate, req)
|
|
804
781
|
self._hydrate(response.function_id, resolver.client, response.handle_metadata)
|
|
805
782
|
|
|
@@ -854,7 +831,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
854
831
|
mount_path=path,
|
|
855
832
|
volume_id=volume.object_id,
|
|
856
833
|
allow_background_commits=True,
|
|
857
|
-
read_only=volume._read_only,
|
|
858
834
|
)
|
|
859
835
|
for path, volume in validated_volumes_no_cloud_buckets
|
|
860
836
|
]
|
|
@@ -1108,7 +1084,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1108
1084
|
mount_path=path,
|
|
1109
1085
|
volume_id=volume.object_id,
|
|
1110
1086
|
allow_background_commits=True,
|
|
1111
|
-
read_only=volume._read_only,
|
|
1112
1087
|
)
|
|
1113
1088
|
for path, volume in options.validated_volumes
|
|
1114
1089
|
]
|
|
@@ -1281,9 +1256,9 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1281
1256
|
) -> "_Function":
|
|
1282
1257
|
"""Reference a Function from a deployed App by its name.
|
|
1283
1258
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
time it is actually used.
|
|
1259
|
+
In contrast to `modal.Function.lookup`, this is a lazy method
|
|
1260
|
+
that defers hydrating the local object with metadata from
|
|
1261
|
+
Modal servers until the first time it is actually used.
|
|
1287
1262
|
|
|
1288
1263
|
```python
|
|
1289
1264
|
f = modal.Function.from_name("other-app", "function")
|
|
@@ -1406,7 +1381,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1406
1381
|
self._method_handle_metadata = dict(metadata.method_handle_metadata)
|
|
1407
1382
|
self._definition_id = metadata.definition_id
|
|
1408
1383
|
self._input_plane_url = metadata.input_plane_url
|
|
1409
|
-
self._input_plane_region = metadata.input_plane_region
|
|
1410
1384
|
|
|
1411
1385
|
def _get_metadata(self):
|
|
1412
1386
|
# Overridden concrete implementation of base class method
|
|
@@ -1422,7 +1396,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1422
1396
|
method_handle_metadata=self._method_handle_metadata,
|
|
1423
1397
|
function_schema=self._metadata.function_schema if self._metadata else None,
|
|
1424
1398
|
input_plane_url=self._input_plane_url,
|
|
1425
|
-
input_plane_region=self._input_plane_region,
|
|
1426
1399
|
)
|
|
1427
1400
|
|
|
1428
1401
|
def _check_no_web_url(self, fn_name: str):
|
|
@@ -1518,7 +1491,6 @@ Use the `Function.get_web_url()` method instead.
|
|
|
1518
1491
|
kwargs,
|
|
1519
1492
|
client=self.client,
|
|
1520
1493
|
input_plane_url=self._input_plane_url,
|
|
1521
|
-
input_plane_region=self._input_plane_region,
|
|
1522
1494
|
)
|
|
1523
1495
|
else:
|
|
1524
1496
|
invocation = await _Invocation.create(
|
|
@@ -1699,9 +1671,8 @@ Use the `Function.get_web_url()` method instead.
|
|
|
1699
1671
|
async def spawn(self, *args: P.args, **kwargs: P.kwargs) -> "_FunctionCall[ReturnType]":
|
|
1700
1672
|
"""Calls the function with the given arguments, without waiting for the results.
|
|
1701
1673
|
|
|
1702
|
-
Returns a [`modal.FunctionCall`](
|
|
1703
|
-
|
|
1704
|
-
[`.get(timeout=...)`](https://modal.com/docs/reference/modal.FunctionCall#get).
|
|
1674
|
+
Returns a [`modal.FunctionCall`](/docs/reference/modal.FunctionCall) object, that can later be polled or
|
|
1675
|
+
waited for using [`.get(timeout=...)`](/docs/reference/modal.FunctionCall#get).
|
|
1705
1676
|
Conceptually similar to `multiprocessing.pool.apply_async`, or a Future/Promise in other contexts.
|
|
1706
1677
|
"""
|
|
1707
1678
|
self._check_no_web_url("spawn")
|
|
@@ -1777,7 +1748,7 @@ class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefix="fc"):
|
|
|
1777
1748
|
"""Returns a structure representing the call graph from a given root
|
|
1778
1749
|
call ID, along with the status of execution for each node.
|
|
1779
1750
|
|
|
1780
|
-
See [`modal.call_graph`](
|
|
1751
|
+
See [`modal.call_graph`](/docs/reference/modal.call_graph) reference page
|
|
1781
1752
|
for documentation on the structure of the returned `InputInfo` items.
|
|
1782
1753
|
"""
|
|
1783
1754
|
assert self._client and self._client.stub
|
|
@@ -1791,7 +1762,7 @@ class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefix="fc"):
|
|
|
1791
1762
|
terminate_containers: bool = False,
|
|
1792
1763
|
):
|
|
1793
1764
|
"""Cancels the function call, which will stop its execution and mark its inputs as
|
|
1794
|
-
[`TERMINATED`](
|
|
1765
|
+
[`TERMINATED`](/docs/reference/modal.call_graph#modalcall_graphinputstatus).
|
|
1795
1766
|
|
|
1796
1767
|
If `terminate_containers=True` - the containers running the cancelled inputs are all terminated
|
|
1797
1768
|
causing any non-cancelled inputs on those containers to be rescheduled in new containers.
|
|
@@ -538,7 +538,7 @@ def _wsgi_app(
|
|
|
538
538
|
Web Server Gateway Interface (WSGI) is a standard for synchronous Python web apps.
|
|
539
539
|
It has been [succeeded by the ASGI interface](https://asgi.readthedocs.io/en/latest/introduction.html#wsgi-compatibility)
|
|
540
540
|
which is compatible with ASGI and supports additional functionality such as web sockets.
|
|
541
|
-
Modal supports ASGI via [`asgi_app`](
|
|
541
|
+
Modal supports ASGI via [`asgi_app`](/docs/reference/modal.asgi_app).
|
|
542
542
|
|
|
543
543
|
**Usage:**
|
|
544
544
|
|
|
@@ -9,21 +9,10 @@ import synchronicity.combined_types
|
|
|
9
9
|
import typing
|
|
10
10
|
import typing_extensions
|
|
11
11
|
|
|
12
|
-
class UserException(Exception):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
...
|
|
16
|
-
|
|
17
|
-
class Sentinel:
|
|
18
|
-
"""Used to get type-stubs to work with this object."""
|
|
19
|
-
|
|
20
|
-
...
|
|
12
|
+
class UserException(Exception): ...
|
|
13
|
+
class Sentinel: ...
|
|
21
14
|
|
|
22
15
|
class IOContext:
|
|
23
|
-
"""Context object for managing input, function calls, and function executions
|
|
24
|
-
in a batched or single input context.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
16
|
input_ids: list[str]
|
|
28
17
|
retry_counts: list[int]
|
|
29
18
|
function_call_ids: list[str]
|
|
@@ -41,10 +30,7 @@ class IOContext:
|
|
|
41
30
|
function_inputs: list[modal_proto.api_pb2.FunctionInput],
|
|
42
31
|
is_batched: bool,
|
|
43
32
|
client: modal.client._Client,
|
|
44
|
-
):
|
|
45
|
-
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
46
|
-
...
|
|
47
|
-
|
|
33
|
+
): ...
|
|
48
34
|
@classmethod
|
|
49
35
|
async def create(
|
|
50
36
|
cls,
|
|
@@ -60,17 +46,12 @@ class IOContext:
|
|
|
60
46
|
def validate_output_data(self, data: typing.Any) -> list[typing.Any]: ...
|
|
61
47
|
|
|
62
48
|
class InputSlots:
|
|
63
|
-
"""A semaphore that allows dynamically adjusting the concurrency."""
|
|
64
|
-
|
|
65
49
|
active: int
|
|
66
50
|
value: int
|
|
67
51
|
waiter: typing.Optional[asyncio.Future]
|
|
68
52
|
closed: bool
|
|
69
53
|
|
|
70
|
-
def __init__(self, value: int) -> None:
|
|
71
|
-
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
72
|
-
...
|
|
73
|
-
|
|
54
|
+
def __init__(self, value: int) -> None: ...
|
|
74
55
|
async def acquire(self) -> None: ...
|
|
75
56
|
def _wake_waiter(self) -> None: ...
|
|
76
57
|
def release(self) -> None: ...
|
|
@@ -78,12 +59,6 @@ class InputSlots:
|
|
|
78
59
|
async def close(self) -> None: ...
|
|
79
60
|
|
|
80
61
|
class _ContainerIOManager:
|
|
81
|
-
"""Synchronizes all RPC calls and network operations for a running container.
|
|
82
|
-
|
|
83
|
-
TODO: maybe we shouldn't synchronize the whole class.
|
|
84
|
-
Then we could potentially move a bunch of the global functions onto it.
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
62
|
task_id: str
|
|
88
63
|
function_id: str
|
|
89
64
|
app_id: str
|
|
@@ -115,15 +90,9 @@ class _ContainerIOManager:
|
|
|
115
90
|
@staticmethod
|
|
116
91
|
def __new__(
|
|
117
92
|
cls, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client._Client
|
|
118
|
-
) -> _ContainerIOManager:
|
|
119
|
-
"""Create and return a new object. See help(type) for accurate signature."""
|
|
120
|
-
...
|
|
121
|
-
|
|
93
|
+
) -> _ContainerIOManager: ...
|
|
122
94
|
@classmethod
|
|
123
|
-
def _reset_singleton(cls):
|
|
124
|
-
"""Only used for tests."""
|
|
125
|
-
...
|
|
126
|
-
|
|
95
|
+
def _reset_singleton(cls): ...
|
|
127
96
|
async def hello(self): ...
|
|
128
97
|
async def _run_heartbeat_loop(self): ...
|
|
129
98
|
async def _heartbeat_handle_cancellations(self) -> bool: ...
|
|
@@ -133,35 +102,15 @@ class _ContainerIOManager:
|
|
|
133
102
|
async def _dynamic_concurrency_loop(self): ...
|
|
134
103
|
def serialize_data_format(self, obj: typing.Any, data_format: int) -> bytes: ...
|
|
135
104
|
async def format_blob_data(self, data: bytes) -> dict[str, typing.Any]: ...
|
|
136
|
-
def get_data_in(self, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]:
|
|
137
|
-
"""Read from the `data_in` stream of a function call."""
|
|
138
|
-
...
|
|
139
|
-
|
|
105
|
+
def get_data_in(self, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]: ...
|
|
140
106
|
async def put_data_out(
|
|
141
107
|
self, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
|
|
142
|
-
) -> None:
|
|
143
|
-
"""Put data onto the `data_out` stream of a function call.
|
|
144
|
-
|
|
145
|
-
This is used for generator outputs, which includes web endpoint responses. Note that this
|
|
146
|
-
was introduced as a performance optimization in client version 0.57, so older clients will
|
|
147
|
-
still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
|
|
148
|
-
"""
|
|
149
|
-
...
|
|
150
|
-
|
|
108
|
+
) -> None: ...
|
|
151
109
|
async def generator_output_task(
|
|
152
110
|
self, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue
|
|
153
|
-
) -> None:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
async def _queue_create(self, size: int) -> asyncio.queues.Queue:
|
|
158
|
-
"""Create a queue, on the synchronicity event loop (needed on Python 3.8 and 3.9)."""
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
async def _queue_put(self, queue: asyncio.queues.Queue, value: typing.Any) -> None:
|
|
162
|
-
"""Put a value onto a queue, using the synchronicity event loop."""
|
|
163
|
-
...
|
|
164
|
-
|
|
111
|
+
) -> None: ...
|
|
112
|
+
async def _queue_create(self, size: int) -> asyncio.queues.Queue: ...
|
|
113
|
+
async def _queue_put(self, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
|
|
165
114
|
def get_average_call_time(self) -> float: ...
|
|
166
115
|
def get_max_inputs_to_fetch(self): ...
|
|
167
116
|
def _generate_inputs(
|
|
@@ -182,33 +131,15 @@ class _ContainerIOManager:
|
|
|
182
131
|
) -> None: ...
|
|
183
132
|
def serialize_exception(self, exc: BaseException) -> bytes: ...
|
|
184
133
|
def serialize_traceback(self, exc: BaseException) -> tuple[typing.Optional[bytes], typing.Optional[bytes]]: ...
|
|
185
|
-
def handle_user_exception(self) -> typing.AsyncContextManager[None]:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
Used for handling exceptions from container lifecycle methods at the moment, which should
|
|
189
|
-
trigger a task failure state.
|
|
190
|
-
"""
|
|
191
|
-
...
|
|
192
|
-
|
|
193
|
-
def handle_input_exception(self, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]:
|
|
194
|
-
"""Handle an exception while processing a function input."""
|
|
195
|
-
...
|
|
196
|
-
|
|
134
|
+
def handle_user_exception(self) -> typing.AsyncContextManager[None]: ...
|
|
135
|
+
def handle_input_exception(self, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]: ...
|
|
197
136
|
def exit_context(self, started_at, input_ids: list[str]): ...
|
|
198
137
|
async def push_outputs(
|
|
199
138
|
self, io_context: IOContext, started_at: float, data: typing.Any, data_format: int
|
|
200
139
|
) -> None: ...
|
|
201
140
|
async def memory_restore(self) -> None: ...
|
|
202
|
-
async def memory_snapshot(self) -> None:
|
|
203
|
-
|
|
204
|
-
...
|
|
205
|
-
|
|
206
|
-
async def volume_commit(self, volume_ids: list[str]) -> None:
|
|
207
|
-
"""Perform volume commit for given `volume_ids`.
|
|
208
|
-
Only used on container exit to persist uncommitted changes on behalf of user.
|
|
209
|
-
"""
|
|
210
|
-
...
|
|
211
|
-
|
|
141
|
+
async def memory_snapshot(self) -> None: ...
|
|
142
|
+
async def volume_commit(self, volume_ids: list[str]) -> None: ...
|
|
212
143
|
async def interact(self, from_breakpoint: bool = False): ...
|
|
213
144
|
@property
|
|
214
145
|
def target_concurrency(self) -> int: ...
|
|
@@ -217,35 +148,15 @@ class _ContainerIOManager:
|
|
|
217
148
|
@property
|
|
218
149
|
def input_concurrency_enabled(self) -> int: ...
|
|
219
150
|
@classmethod
|
|
220
|
-
def get_input_concurrency(cls) -> int:
|
|
221
|
-
"""Returns the number of usable input slots.
|
|
222
|
-
|
|
223
|
-
If concurrency is reduced, active slots can exceed allotted slots. Returns the larger value
|
|
224
|
-
in this case.
|
|
225
|
-
"""
|
|
226
|
-
...
|
|
227
|
-
|
|
151
|
+
def get_input_concurrency(cls) -> int: ...
|
|
228
152
|
@classmethod
|
|
229
|
-
def set_input_concurrency(cls, concurrency: int):
|
|
230
|
-
"""Edit the number of input slots.
|
|
231
|
-
|
|
232
|
-
This disables the background loop which automatically adjusts concurrency
|
|
233
|
-
within [target_concurrency, max_concurrency].
|
|
234
|
-
"""
|
|
235
|
-
...
|
|
236
|
-
|
|
153
|
+
def set_input_concurrency(cls, concurrency: int): ...
|
|
237
154
|
@classmethod
|
|
238
155
|
def stop_fetching_inputs(cls): ...
|
|
239
156
|
|
|
240
157
|
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
|
241
158
|
|
|
242
159
|
class ContainerIOManager:
|
|
243
|
-
"""Synchronizes all RPC calls and network operations for a running container.
|
|
244
|
-
|
|
245
|
-
TODO: maybe we shouldn't synchronize the whole class.
|
|
246
|
-
Then we could potentially move a bunch of the global functions onto it.
|
|
247
|
-
"""
|
|
248
|
-
|
|
249
160
|
task_id: str
|
|
250
161
|
function_id: str
|
|
251
162
|
app_id: str
|
|
@@ -271,17 +182,12 @@ class ContainerIOManager:
|
|
|
271
182
|
_GENERATOR_STOP_SENTINEL: typing.ClassVar[Sentinel]
|
|
272
183
|
_singleton: typing.ClassVar[typing.Optional[ContainerIOManager]]
|
|
273
184
|
|
|
274
|
-
def __init__(self, /, *args, **kwargs):
|
|
275
|
-
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
276
|
-
...
|
|
277
|
-
|
|
185
|
+
def __init__(self, /, *args, **kwargs): ...
|
|
278
186
|
def _init(self, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client.Client): ...
|
|
279
187
|
@property
|
|
280
188
|
def heartbeat_condition(self) -> asyncio.locks.Condition: ...
|
|
281
189
|
@classmethod
|
|
282
|
-
def _reset_singleton(cls):
|
|
283
|
-
"""Only used for tests."""
|
|
284
|
-
...
|
|
190
|
+
def _reset_singleton(cls): ...
|
|
285
191
|
|
|
286
192
|
class __hello_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
287
193
|
def __call__(self, /): ...
|
|
@@ -332,71 +238,36 @@ class ContainerIOManager:
|
|
|
332
238
|
format_blob_data: __format_blob_data_spec[typing_extensions.Self]
|
|
333
239
|
|
|
334
240
|
class __get_data_in_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
335
|
-
def __call__(self, /, function_call_id: str) -> typing.Iterator[typing.Any]:
|
|
336
|
-
|
|
337
|
-
...
|
|
338
|
-
|
|
339
|
-
def aio(self, /, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]:
|
|
340
|
-
"""Read from the `data_in` stream of a function call."""
|
|
341
|
-
...
|
|
241
|
+
def __call__(self, /, function_call_id: str) -> typing.Iterator[typing.Any]: ...
|
|
242
|
+
def aio(self, /, function_call_id: str) -> collections.abc.AsyncIterator[typing.Any]: ...
|
|
342
243
|
|
|
343
244
|
get_data_in: __get_data_in_spec[typing_extensions.Self]
|
|
344
245
|
|
|
345
246
|
class __put_data_out_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
346
247
|
def __call__(
|
|
347
248
|
self, /, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
|
|
348
|
-
) -> None:
|
|
349
|
-
"""Put data onto the `data_out` stream of a function call.
|
|
350
|
-
|
|
351
|
-
This is used for generator outputs, which includes web endpoint responses. Note that this
|
|
352
|
-
was introduced as a performance optimization in client version 0.57, so older clients will
|
|
353
|
-
still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
|
|
354
|
-
"""
|
|
355
|
-
...
|
|
356
|
-
|
|
249
|
+
) -> None: ...
|
|
357
250
|
async def aio(
|
|
358
251
|
self, /, function_call_id: str, start_index: int, data_format: int, serialized_messages: list[typing.Any]
|
|
359
|
-
) -> None:
|
|
360
|
-
"""Put data onto the `data_out` stream of a function call.
|
|
361
|
-
|
|
362
|
-
This is used for generator outputs, which includes web endpoint responses. Note that this
|
|
363
|
-
was introduced as a performance optimization in client version 0.57, so older clients will
|
|
364
|
-
still use the previous Postgres-backed system based on `FunctionPutOutputs()`.
|
|
365
|
-
"""
|
|
366
|
-
...
|
|
252
|
+
) -> None: ...
|
|
367
253
|
|
|
368
254
|
put_data_out: __put_data_out_spec[typing_extensions.Self]
|
|
369
255
|
|
|
370
256
|
class __generator_output_task_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
371
|
-
def __call__(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
|
|
372
|
-
|
|
373
|
-
...
|
|
374
|
-
|
|
375
|
-
async def aio(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
|
|
376
|
-
"""Task that feeds generator outputs into a function call's `data_out` stream."""
|
|
377
|
-
...
|
|
257
|
+
def __call__(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None: ...
|
|
258
|
+
async def aio(self, /, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None: ...
|
|
378
259
|
|
|
379
260
|
generator_output_task: __generator_output_task_spec[typing_extensions.Self]
|
|
380
261
|
|
|
381
262
|
class ___queue_create_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
382
|
-
def __call__(self, /, size: int) -> asyncio.queues.Queue:
|
|
383
|
-
|
|
384
|
-
...
|
|
385
|
-
|
|
386
|
-
async def aio(self, /, size: int) -> asyncio.queues.Queue:
|
|
387
|
-
"""Create a queue, on the synchronicity event loop (needed on Python 3.8 and 3.9)."""
|
|
388
|
-
...
|
|
263
|
+
def __call__(self, /, size: int) -> asyncio.queues.Queue: ...
|
|
264
|
+
async def aio(self, /, size: int) -> asyncio.queues.Queue: ...
|
|
389
265
|
|
|
390
266
|
_queue_create: ___queue_create_spec[typing_extensions.Self]
|
|
391
267
|
|
|
392
268
|
class ___queue_put_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
393
|
-
def __call__(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None:
|
|
394
|
-
|
|
395
|
-
...
|
|
396
|
-
|
|
397
|
-
async def aio(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None:
|
|
398
|
-
"""Put a value onto a queue, using the synchronicity event loop."""
|
|
399
|
-
...
|
|
269
|
+
def __call__(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
|
|
270
|
+
async def aio(self, /, queue: asyncio.queues.Queue, value: typing.Any) -> None: ...
|
|
400
271
|
|
|
401
272
|
_queue_put: ___queue_put_spec[typing_extensions.Self]
|
|
402
273
|
|
|
@@ -455,34 +326,16 @@ class ContainerIOManager:
|
|
|
455
326
|
def serialize_traceback(self, exc: BaseException) -> tuple[typing.Optional[bytes], typing.Optional[bytes]]: ...
|
|
456
327
|
|
|
457
328
|
class __handle_user_exception_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
458
|
-
def __call__(self, /) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
Used for handling exceptions from container lifecycle methods at the moment, which should
|
|
462
|
-
trigger a task failure state.
|
|
463
|
-
"""
|
|
464
|
-
...
|
|
465
|
-
|
|
466
|
-
def aio(self, /) -> typing.AsyncContextManager[None]:
|
|
467
|
-
"""Sets the task as failed in a way where it's not retried.
|
|
468
|
-
|
|
469
|
-
Used for handling exceptions from container lifecycle methods at the moment, which should
|
|
470
|
-
trigger a task failure state.
|
|
471
|
-
"""
|
|
472
|
-
...
|
|
329
|
+
def __call__(self, /) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]: ...
|
|
330
|
+
def aio(self, /) -> typing.AsyncContextManager[None]: ...
|
|
473
331
|
|
|
474
332
|
handle_user_exception: __handle_user_exception_spec[typing_extensions.Self]
|
|
475
333
|
|
|
476
334
|
class __handle_input_exception_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
477
335
|
def __call__(
|
|
478
336
|
self, /, io_context: IOContext, started_at: float
|
|
479
|
-
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
|
|
480
|
-
|
|
481
|
-
...
|
|
482
|
-
|
|
483
|
-
def aio(self, /, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]:
|
|
484
|
-
"""Handle an exception while processing a function input."""
|
|
485
|
-
...
|
|
337
|
+
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]: ...
|
|
338
|
+
def aio(self, /, io_context: IOContext, started_at: float) -> typing.AsyncContextManager[None]: ...
|
|
486
339
|
|
|
487
340
|
handle_input_exception: __handle_input_exception_spec[typing_extensions.Self]
|
|
488
341
|
|
|
@@ -503,28 +356,14 @@ class ContainerIOManager:
|
|
|
503
356
|
memory_restore: __memory_restore_spec[typing_extensions.Self]
|
|
504
357
|
|
|
505
358
|
class __memory_snapshot_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
506
|
-
def __call__(self, /) -> None:
|
|
507
|
-
|
|
508
|
-
...
|
|
509
|
-
|
|
510
|
-
async def aio(self, /) -> None:
|
|
511
|
-
"""Message server indicating that function is ready to be checkpointed."""
|
|
512
|
-
...
|
|
359
|
+
def __call__(self, /) -> None: ...
|
|
360
|
+
async def aio(self, /) -> None: ...
|
|
513
361
|
|
|
514
362
|
memory_snapshot: __memory_snapshot_spec[typing_extensions.Self]
|
|
515
363
|
|
|
516
364
|
class __volume_commit_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
517
|
-
def __call__(self, /, volume_ids: list[str]) -> None:
|
|
518
|
-
|
|
519
|
-
Only used on container exit to persist uncommitted changes on behalf of user.
|
|
520
|
-
"""
|
|
521
|
-
...
|
|
522
|
-
|
|
523
|
-
async def aio(self, /, volume_ids: list[str]) -> None:
|
|
524
|
-
"""Perform volume commit for given `volume_ids`.
|
|
525
|
-
Only used on container exit to persist uncommitted changes on behalf of user.
|
|
526
|
-
"""
|
|
527
|
-
...
|
|
365
|
+
def __call__(self, /, volume_ids: list[str]) -> None: ...
|
|
366
|
+
async def aio(self, /, volume_ids: list[str]) -> None: ...
|
|
528
367
|
|
|
529
368
|
volume_commit: __volume_commit_spec[typing_extensions.Self]
|
|
530
369
|
|
|
@@ -541,34 +380,13 @@ class ContainerIOManager:
|
|
|
541
380
|
@property
|
|
542
381
|
def input_concurrency_enabled(self) -> int: ...
|
|
543
382
|
@classmethod
|
|
544
|
-
def get_input_concurrency(cls) -> int:
|
|
545
|
-
"""Returns the number of usable input slots.
|
|
546
|
-
|
|
547
|
-
If concurrency is reduced, active slots can exceed allotted slots. Returns the larger value
|
|
548
|
-
in this case.
|
|
549
|
-
"""
|
|
550
|
-
...
|
|
551
|
-
|
|
383
|
+
def get_input_concurrency(cls) -> int: ...
|
|
552
384
|
@classmethod
|
|
553
|
-
def set_input_concurrency(cls, concurrency: int):
|
|
554
|
-
"""Edit the number of input slots.
|
|
555
|
-
|
|
556
|
-
This disables the background loop which automatically adjusts concurrency
|
|
557
|
-
within [target_concurrency, max_concurrency].
|
|
558
|
-
"""
|
|
559
|
-
...
|
|
560
|
-
|
|
385
|
+
def set_input_concurrency(cls, concurrency: int): ...
|
|
561
386
|
@classmethod
|
|
562
387
|
def stop_fetching_inputs(cls): ...
|
|
563
388
|
|
|
564
|
-
def check_fastapi_pydantic_compatibility(exc: ImportError) -> None:
|
|
565
|
-
"""Add a helpful note to an exception that is likely caused by a pydantic<>fastapi version incompatibility.
|
|
566
|
-
|
|
567
|
-
We need this becasue the legacy set of container requirements (image_builder_version=2023.12) contains a
|
|
568
|
-
version of fastapi that is not forwards-compatible with pydantic 2.0+, and users commonly run into issues
|
|
569
|
-
building an image that specifies a more recent version only for pydantic.
|
|
570
|
-
"""
|
|
571
|
-
...
|
|
389
|
+
def check_fastapi_pydantic_compatibility(exc: ImportError) -> None: ...
|
|
572
390
|
|
|
573
391
|
MAX_OUTPUT_BATCH_SIZE: int
|
|
574
392
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
import contextvars
|
|
3
|
+
import typing
|
|
4
|
+
import typing_extensions
|
|
5
|
+
|
|
6
|
+
def is_local() -> bool: ...
|
|
7
|
+
async def _interact() -> None: ...
|
|
8
|
+
|
|
9
|
+
class __interact_spec(typing_extensions.Protocol):
|
|
10
|
+
def __call__(self, /) -> None: ...
|
|
11
|
+
async def aio(self, /) -> None: ...
|
|
12
|
+
|
|
13
|
+
interact: __interact_spec
|
|
14
|
+
|
|
15
|
+
def current_input_id() -> typing.Optional[str]: ...
|
|
16
|
+
def current_function_call_id() -> typing.Optional[str]: ...
|
|
17
|
+
def _set_current_context_ids(
|
|
18
|
+
input_ids: list[str], function_call_ids: list[str]
|
|
19
|
+
) -> collections.abc.Callable[[], None]: ...
|
|
20
|
+
def _import_context(): ...
|
|
21
|
+
|
|
22
|
+
_current_input_id: contextvars.ContextVar
|
|
23
|
+
|
|
24
|
+
_current_function_call_id: contextvars.ContextVar
|