modal 0.62.115__py3-none-any.whl → 0.72.13__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.
- modal/__init__.py +13 -9
- modal/__main__.py +41 -3
- modal/_clustered_functions.py +80 -0
- modal/_clustered_functions.pyi +22 -0
- modal/_container_entrypoint.py +402 -398
- modal/_ipython.py +3 -13
- modal/_location.py +17 -10
- modal/_output.py +243 -99
- modal/_pty.py +2 -2
- modal/_resolver.py +55 -60
- modal/_resources.py +26 -7
- modal/_runtime/__init__.py +1 -0
- modal/_runtime/asgi.py +519 -0
- modal/_runtime/container_io_manager.py +1025 -0
- modal/{execution_context.py → _runtime/execution_context.py} +11 -2
- modal/_runtime/telemetry.py +169 -0
- modal/_runtime/user_code_imports.py +356 -0
- modal/_serialization.py +123 -6
- modal/_traceback.py +47 -187
- modal/_tunnel.py +50 -14
- modal/_tunnel.pyi +19 -36
- modal/_utils/app_utils.py +3 -17
- modal/_utils/async_utils.py +386 -104
- modal/_utils/blob_utils.py +157 -186
- modal/_utils/bytes_io_segment_payload.py +97 -0
- modal/_utils/deprecation.py +89 -0
- modal/_utils/docker_utils.py +98 -0
- modal/_utils/function_utils.py +299 -98
- modal/_utils/grpc_testing.py +47 -34
- modal/_utils/grpc_utils.py +54 -21
- modal/_utils/hash_utils.py +51 -10
- modal/_utils/http_utils.py +39 -9
- modal/_utils/logger.py +2 -1
- modal/_utils/mount_utils.py +34 -16
- modal/_utils/name_utils.py +58 -0
- modal/_utils/package_utils.py +14 -1
- modal/_utils/pattern_utils.py +205 -0
- modal/_utils/rand_pb_testing.py +3 -3
- modal/_utils/shell_utils.py +15 -49
- modal/_vendor/a2wsgi_wsgi.py +62 -72
- modal/_vendor/cloudpickle.py +1 -1
- modal/_watcher.py +12 -10
- modal/app.py +561 -323
- modal/app.pyi +474 -262
- modal/call_graph.py +7 -6
- modal/cli/_download.py +22 -6
- modal/cli/_traceback.py +200 -0
- modal/cli/app.py +203 -42
- modal/cli/config.py +12 -5
- modal/cli/container.py +61 -13
- modal/cli/dict.py +128 -0
- modal/cli/entry_point.py +26 -13
- modal/cli/environment.py +40 -9
- modal/cli/import_refs.py +21 -48
- modal/cli/launch.py +28 -14
- modal/cli/network_file_system.py +57 -21
- modal/cli/profile.py +1 -1
- modal/cli/programs/run_jupyter.py +34 -9
- modal/cli/programs/vscode.py +58 -8
- modal/cli/queues.py +131 -0
- modal/cli/run.py +199 -96
- modal/cli/secret.py +5 -4
- modal/cli/token.py +7 -2
- modal/cli/utils.py +74 -8
- modal/cli/volume.py +97 -56
- modal/client.py +248 -144
- modal/client.pyi +156 -124
- modal/cloud_bucket_mount.py +43 -30
- modal/cloud_bucket_mount.pyi +32 -25
- modal/cls.py +528 -141
- modal/cls.pyi +189 -145
- modal/config.py +32 -15
- modal/container_process.py +177 -0
- modal/container_process.pyi +82 -0
- modal/dict.py +50 -54
- modal/dict.pyi +120 -164
- modal/environments.py +106 -5
- modal/environments.pyi +77 -25
- modal/exception.py +30 -43
- modal/experimental.py +62 -2
- modal/file_io.py +537 -0
- modal/file_io.pyi +235 -0
- modal/file_pattern_matcher.py +196 -0
- modal/functions.py +846 -428
- modal/functions.pyi +446 -387
- modal/gpu.py +57 -44
- modal/image.py +943 -417
- modal/image.pyi +584 -245
- modal/io_streams.py +434 -0
- modal/io_streams.pyi +122 -0
- modal/mount.py +223 -90
- modal/mount.pyi +241 -243
- modal/network_file_system.py +85 -86
- modal/network_file_system.pyi +151 -110
- modal/object.py +66 -36
- modal/object.pyi +166 -143
- modal/output.py +63 -0
- modal/parallel_map.py +73 -47
- modal/parallel_map.pyi +51 -63
- modal/partial_function.py +272 -107
- modal/partial_function.pyi +219 -120
- modal/proxy.py +15 -12
- modal/proxy.pyi +3 -8
- modal/queue.py +96 -72
- modal/queue.pyi +210 -135
- modal/requirements/2024.04.txt +2 -1
- modal/requirements/2024.10.txt +16 -0
- modal/requirements/README.md +21 -0
- modal/requirements/base-images.json +22 -0
- modal/retries.py +45 -4
- modal/runner.py +325 -203
- modal/runner.pyi +124 -110
- modal/running_app.py +27 -4
- modal/sandbox.py +509 -231
- modal/sandbox.pyi +396 -169
- modal/schedule.py +2 -2
- modal/scheduler_placement.py +20 -3
- modal/secret.py +41 -25
- modal/secret.pyi +62 -42
- modal/serving.py +39 -49
- modal/serving.pyi +37 -43
- modal/stream_type.py +15 -0
- modal/token_flow.py +5 -3
- modal/token_flow.pyi +37 -32
- modal/volume.py +123 -137
- modal/volume.pyi +228 -221
- {modal-0.62.115.dist-info → modal-0.72.13.dist-info}/METADATA +5 -5
- modal-0.72.13.dist-info/RECORD +174 -0
- {modal-0.62.115.dist-info → modal-0.72.13.dist-info}/top_level.txt +0 -1
- modal_docs/gen_reference_docs.py +3 -1
- modal_docs/mdmd/mdmd.py +0 -1
- modal_docs/mdmd/signatures.py +1 -2
- modal_global_objects/images/base_images.py +28 -0
- modal_global_objects/mounts/python_standalone.py +2 -2
- modal_proto/__init__.py +1 -1
- modal_proto/api.proto +1231 -531
- modal_proto/api_grpc.py +750 -430
- modal_proto/api_pb2.py +2102 -1176
- modal_proto/api_pb2.pyi +8859 -0
- modal_proto/api_pb2_grpc.py +1329 -675
- modal_proto/api_pb2_grpc.pyi +1416 -0
- modal_proto/modal_api_grpc.py +149 -0
- modal_proto/modal_options_grpc.py +3 -0
- modal_proto/options_pb2.pyi +20 -0
- modal_proto/options_pb2_grpc.pyi +7 -0
- modal_proto/py.typed +0 -0
- modal_version/__init__.py +1 -1
- modal_version/_version_generated.py +2 -2
- modal/_asgi.py +0 -370
- modal/_container_exec.py +0 -128
- modal/_container_io_manager.py +0 -646
- modal/_container_io_manager.pyi +0 -412
- modal/_sandbox_shell.py +0 -49
- modal/app_utils.py +0 -20
- modal/app_utils.pyi +0 -17
- modal/execution_context.pyi +0 -37
- modal/shared_volume.py +0 -23
- modal/shared_volume.pyi +0 -24
- modal-0.62.115.dist-info/RECORD +0 -207
- modal_global_objects/images/conda.py +0 -15
- modal_global_objects/images/debian_slim.py +0 -15
- modal_global_objects/images/micromamba.py +0 -15
- test/__init__.py +0 -1
- test/aio_test.py +0 -12
- test/async_utils_test.py +0 -279
- test/blob_test.py +0 -67
- test/cli_imports_test.py +0 -149
- test/cli_test.py +0 -674
- test/client_test.py +0 -203
- test/cloud_bucket_mount_test.py +0 -22
- test/cls_test.py +0 -636
- test/config_test.py +0 -149
- test/conftest.py +0 -1485
- test/container_app_test.py +0 -50
- test/container_test.py +0 -1405
- test/cpu_test.py +0 -23
- test/decorator_test.py +0 -85
- test/deprecation_test.py +0 -34
- test/dict_test.py +0 -51
- test/e2e_test.py +0 -68
- test/error_test.py +0 -7
- test/function_serialization_test.py +0 -32
- test/function_test.py +0 -791
- test/function_utils_test.py +0 -101
- test/gpu_test.py +0 -159
- test/grpc_utils_test.py +0 -82
- test/helpers.py +0 -47
- test/image_test.py +0 -814
- test/live_reload_test.py +0 -80
- test/lookup_test.py +0 -70
- test/mdmd_test.py +0 -329
- test/mount_test.py +0 -162
- test/mounted_files_test.py +0 -327
- test/network_file_system_test.py +0 -188
- test/notebook_test.py +0 -66
- test/object_test.py +0 -41
- test/package_utils_test.py +0 -25
- test/queue_test.py +0 -115
- test/resolver_test.py +0 -59
- test/retries_test.py +0 -67
- test/runner_test.py +0 -85
- test/sandbox_test.py +0 -191
- test/schedule_test.py +0 -15
- test/scheduler_placement_test.py +0 -57
- test/secret_test.py +0 -89
- test/serialization_test.py +0 -50
- test/stub_composition_test.py +0 -10
- test/stub_test.py +0 -361
- test/test_asgi_wrapper.py +0 -234
- test/token_flow_test.py +0 -18
- test/traceback_test.py +0 -135
- test/tunnel_test.py +0 -29
- test/utils_test.py +0 -88
- test/version_test.py +0 -14
- test/volume_test.py +0 -397
- test/watcher_test.py +0 -58
- test/webhook_test.py +0 -145
- {modal-0.62.115.dist-info → modal-0.72.13.dist-info}/LICENSE +0 -0
- {modal-0.62.115.dist-info → modal-0.72.13.dist-info}/WHEEL +0 -0
- {modal-0.62.115.dist-info → modal-0.72.13.dist-info}/entry_points.txt +0 -0
modal/_container_io_manager.pyi
DELETED
@@ -1,412 +0,0 @@
|
|
1
|
-
import _asyncio
|
2
|
-
import asyncio.locks
|
3
|
-
import asyncio.queues
|
4
|
-
import modal.client
|
5
|
-
import modal.running_app
|
6
|
-
import modal_proto.api_pb2
|
7
|
-
import synchronicity.combined_types
|
8
|
-
import typing
|
9
|
-
import typing_extensions
|
10
|
-
|
11
|
-
class UserException(Exception):
|
12
|
-
...
|
13
|
-
|
14
|
-
class Sentinel:
|
15
|
-
...
|
16
|
-
|
17
|
-
class _ContainerIOManager:
|
18
|
-
cancelled_input_ids: typing.Set[str]
|
19
|
-
task_id: str
|
20
|
-
function_id: str
|
21
|
-
app_id: str
|
22
|
-
function_def: modal_proto.api_pb2.Function
|
23
|
-
checkpoint_id: typing.Union[str, None]
|
24
|
-
calls_completed: int
|
25
|
-
total_user_time: float
|
26
|
-
current_input_id: typing.Union[str, None]
|
27
|
-
current_input_started_at: typing.Union[float, None]
|
28
|
-
_input_concurrency: typing.Union[int, None]
|
29
|
-
_semaphore: typing.Union[asyncio.locks.Semaphore, None]
|
30
|
-
_environment_name: str
|
31
|
-
_waiting_for_checkpoint: bool
|
32
|
-
_heartbeat_loop: typing.Union[_asyncio.Task, None]
|
33
|
-
_is_interactivity_enabled: bool
|
34
|
-
_fetching_inputs: bool
|
35
|
-
_client: modal.client._Client
|
36
|
-
_GENERATOR_STOP_SENTINEL: typing.ClassVar[Sentinel]
|
37
|
-
_singleton: typing.ClassVar[typing.Union[_ContainerIOManager, None]]
|
38
|
-
|
39
|
-
def _init(self, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client._Client):
|
40
|
-
...
|
41
|
-
|
42
|
-
@staticmethod
|
43
|
-
def __new__(cls, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client._Client) -> _ContainerIOManager:
|
44
|
-
...
|
45
|
-
|
46
|
-
@classmethod
|
47
|
-
def _reset_singleton(cls):
|
48
|
-
...
|
49
|
-
|
50
|
-
async def _run_heartbeat_loop(self):
|
51
|
-
...
|
52
|
-
|
53
|
-
async def _heartbeat_handle_cancellations(self) -> bool:
|
54
|
-
...
|
55
|
-
|
56
|
-
def heartbeats(self) -> typing.AsyncContextManager[None]:
|
57
|
-
...
|
58
|
-
|
59
|
-
def stop_heartbeat(self):
|
60
|
-
...
|
61
|
-
|
62
|
-
async def get_app_objects(self) -> modal.running_app.RunningApp:
|
63
|
-
...
|
64
|
-
|
65
|
-
async def get_serialized_function(self) -> typing.Tuple[typing.Union[typing.Any, None], typing.Callable]:
|
66
|
-
...
|
67
|
-
|
68
|
-
def serialize(self, obj: typing.Any) -> bytes:
|
69
|
-
...
|
70
|
-
|
71
|
-
def deserialize(self, data: bytes) -> typing.Any:
|
72
|
-
...
|
73
|
-
|
74
|
-
def serialize_data_format(self, obj: typing.Any, data_format: int) -> bytes:
|
75
|
-
...
|
76
|
-
|
77
|
-
def deserialize_data_format(self, data: bytes, data_format: int) -> typing.Any:
|
78
|
-
...
|
79
|
-
|
80
|
-
def get_data_in(self, function_call_id: str) -> typing.AsyncIterator[typing.Any]:
|
81
|
-
...
|
82
|
-
|
83
|
-
async def put_data_out(self, function_call_id: str, start_index: int, data_format: int, messages_bytes: typing.List[typing.Any]) -> None:
|
84
|
-
...
|
85
|
-
|
86
|
-
async def generator_output_task(self, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
|
87
|
-
...
|
88
|
-
|
89
|
-
async def _queue_create(self, size: int) -> asyncio.queues.Queue:
|
90
|
-
...
|
91
|
-
|
92
|
-
async def _queue_put(self, queue: asyncio.queues.Queue, value: typing.Any) -> None:
|
93
|
-
...
|
94
|
-
|
95
|
-
async def populate_input_blobs(self, item: modal_proto.api_pb2.FunctionInput):
|
96
|
-
...
|
97
|
-
|
98
|
-
def get_average_call_time(self) -> float:
|
99
|
-
...
|
100
|
-
|
101
|
-
def get_max_inputs_to_fetch(self):
|
102
|
-
...
|
103
|
-
|
104
|
-
def _generate_inputs(self) -> typing.AsyncIterator[typing.Tuple[str, str, modal_proto.api_pb2.FunctionInput]]:
|
105
|
-
...
|
106
|
-
|
107
|
-
def run_inputs_outputs(self, input_concurrency: int = 1) -> typing.AsyncIterator[typing.Tuple[str, str, typing.Any, typing.Any]]:
|
108
|
-
...
|
109
|
-
|
110
|
-
async def _push_output(self, input_id, started_at: float, data_format=0, **kwargs):
|
111
|
-
...
|
112
|
-
|
113
|
-
def serialize_exception(self, exc: BaseException) -> typing.Union[bytes, None]:
|
114
|
-
...
|
115
|
-
|
116
|
-
def serialize_traceback(self, exc: BaseException) -> typing.Tuple[typing.Union[bytes, None], typing.Union[bytes, None]]:
|
117
|
-
...
|
118
|
-
|
119
|
-
def handle_user_exception(self) -> typing.AsyncContextManager[None]:
|
120
|
-
...
|
121
|
-
|
122
|
-
def handle_input_exception(self, input_id, started_at: float) -> typing.AsyncContextManager[None]:
|
123
|
-
...
|
124
|
-
|
125
|
-
async def complete_call(self, started_at):
|
126
|
-
...
|
127
|
-
|
128
|
-
async def push_output(self, input_id, started_at: float, data: typing.Any, data_format: int) -> None:
|
129
|
-
...
|
130
|
-
|
131
|
-
async def restore(self) -> None:
|
132
|
-
...
|
133
|
-
|
134
|
-
async def checkpoint(self) -> None:
|
135
|
-
...
|
136
|
-
|
137
|
-
async def volume_commit(self, volume_ids: typing.List[str]) -> None:
|
138
|
-
...
|
139
|
-
|
140
|
-
async def interact(self):
|
141
|
-
...
|
142
|
-
|
143
|
-
@classmethod
|
144
|
-
def stop_fetching_inputs(cls):
|
145
|
-
...
|
146
|
-
|
147
|
-
|
148
|
-
class ContainerIOManager:
|
149
|
-
cancelled_input_ids: typing.Set[str]
|
150
|
-
task_id: str
|
151
|
-
function_id: str
|
152
|
-
app_id: str
|
153
|
-
function_def: modal_proto.api_pb2.Function
|
154
|
-
checkpoint_id: typing.Union[str, None]
|
155
|
-
calls_completed: int
|
156
|
-
total_user_time: float
|
157
|
-
current_input_id: typing.Union[str, None]
|
158
|
-
current_input_started_at: typing.Union[float, None]
|
159
|
-
_input_concurrency: typing.Union[int, None]
|
160
|
-
_semaphore: typing.Union[asyncio.locks.Semaphore, None]
|
161
|
-
_environment_name: str
|
162
|
-
_waiting_for_checkpoint: bool
|
163
|
-
_heartbeat_loop: typing.Union[_asyncio.Task, None]
|
164
|
-
_is_interactivity_enabled: bool
|
165
|
-
_fetching_inputs: bool
|
166
|
-
_client: modal.client.Client
|
167
|
-
_GENERATOR_STOP_SENTINEL: typing.ClassVar[Sentinel]
|
168
|
-
_singleton: typing.ClassVar[typing.Union[ContainerIOManager, None]]
|
169
|
-
|
170
|
-
def __init__(self, /, *args, **kwargs):
|
171
|
-
...
|
172
|
-
|
173
|
-
def _init(self, container_args: modal_proto.api_pb2.ContainerArguments, client: modal.client.Client):
|
174
|
-
...
|
175
|
-
|
176
|
-
@classmethod
|
177
|
-
def _reset_singleton(cls):
|
178
|
-
...
|
179
|
-
|
180
|
-
class ___run_heartbeat_loop_spec(typing_extensions.Protocol):
|
181
|
-
def __call__(self):
|
182
|
-
...
|
183
|
-
|
184
|
-
async def aio(self, *args, **kwargs):
|
185
|
-
...
|
186
|
-
|
187
|
-
_run_heartbeat_loop: ___run_heartbeat_loop_spec
|
188
|
-
|
189
|
-
class ___heartbeat_handle_cancellations_spec(typing_extensions.Protocol):
|
190
|
-
def __call__(self) -> bool:
|
191
|
-
...
|
192
|
-
|
193
|
-
async def aio(self, *args, **kwargs) -> bool:
|
194
|
-
...
|
195
|
-
|
196
|
-
_heartbeat_handle_cancellations: ___heartbeat_handle_cancellations_spec
|
197
|
-
|
198
|
-
class __heartbeats_spec(typing_extensions.Protocol):
|
199
|
-
def __call__(self) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
|
200
|
-
...
|
201
|
-
|
202
|
-
def aio(self) -> typing.AsyncContextManager[None]:
|
203
|
-
...
|
204
|
-
|
205
|
-
heartbeats: __heartbeats_spec
|
206
|
-
|
207
|
-
def stop_heartbeat(self):
|
208
|
-
...
|
209
|
-
|
210
|
-
class __get_app_objects_spec(typing_extensions.Protocol):
|
211
|
-
def __call__(self) -> modal.running_app.RunningApp:
|
212
|
-
...
|
213
|
-
|
214
|
-
async def aio(self, *args, **kwargs) -> modal.running_app.RunningApp:
|
215
|
-
...
|
216
|
-
|
217
|
-
get_app_objects: __get_app_objects_spec
|
218
|
-
|
219
|
-
class __get_serialized_function_spec(typing_extensions.Protocol):
|
220
|
-
def __call__(self) -> typing.Tuple[typing.Union[typing.Any, None], typing.Callable]:
|
221
|
-
...
|
222
|
-
|
223
|
-
async def aio(self, *args, **kwargs) -> typing.Tuple[typing.Union[typing.Any, None], typing.Callable]:
|
224
|
-
...
|
225
|
-
|
226
|
-
get_serialized_function: __get_serialized_function_spec
|
227
|
-
|
228
|
-
def serialize(self, obj: typing.Any) -> bytes:
|
229
|
-
...
|
230
|
-
|
231
|
-
def deserialize(self, data: bytes) -> typing.Any:
|
232
|
-
...
|
233
|
-
|
234
|
-
def serialize_data_format(self, obj: typing.Any, data_format: int) -> bytes:
|
235
|
-
...
|
236
|
-
|
237
|
-
def deserialize_data_format(self, data: bytes, data_format: int) -> typing.Any:
|
238
|
-
...
|
239
|
-
|
240
|
-
class __get_data_in_spec(typing_extensions.Protocol):
|
241
|
-
def __call__(self, function_call_id: str) -> typing.Iterator[typing.Any]:
|
242
|
-
...
|
243
|
-
|
244
|
-
def aio(self, function_call_id: str) -> typing.AsyncIterator[typing.Any]:
|
245
|
-
...
|
246
|
-
|
247
|
-
get_data_in: __get_data_in_spec
|
248
|
-
|
249
|
-
class __put_data_out_spec(typing_extensions.Protocol):
|
250
|
-
def __call__(self, function_call_id: str, start_index: int, data_format: int, messages_bytes: typing.List[typing.Any]) -> None:
|
251
|
-
...
|
252
|
-
|
253
|
-
async def aio(self, *args, **kwargs) -> None:
|
254
|
-
...
|
255
|
-
|
256
|
-
put_data_out: __put_data_out_spec
|
257
|
-
|
258
|
-
class __generator_output_task_spec(typing_extensions.Protocol):
|
259
|
-
def __call__(self, function_call_id: str, data_format: int, message_rx: asyncio.queues.Queue) -> None:
|
260
|
-
...
|
261
|
-
|
262
|
-
async def aio(self, *args, **kwargs) -> None:
|
263
|
-
...
|
264
|
-
|
265
|
-
generator_output_task: __generator_output_task_spec
|
266
|
-
|
267
|
-
class ___queue_create_spec(typing_extensions.Protocol):
|
268
|
-
def __call__(self, size: int) -> asyncio.queues.Queue:
|
269
|
-
...
|
270
|
-
|
271
|
-
async def aio(self, *args, **kwargs) -> asyncio.queues.Queue:
|
272
|
-
...
|
273
|
-
|
274
|
-
_queue_create: ___queue_create_spec
|
275
|
-
|
276
|
-
class ___queue_put_spec(typing_extensions.Protocol):
|
277
|
-
def __call__(self, queue: asyncio.queues.Queue, value: typing.Any) -> None:
|
278
|
-
...
|
279
|
-
|
280
|
-
async def aio(self, *args, **kwargs) -> None:
|
281
|
-
...
|
282
|
-
|
283
|
-
_queue_put: ___queue_put_spec
|
284
|
-
|
285
|
-
class __populate_input_blobs_spec(typing_extensions.Protocol):
|
286
|
-
def __call__(self, item: modal_proto.api_pb2.FunctionInput):
|
287
|
-
...
|
288
|
-
|
289
|
-
async def aio(self, *args, **kwargs):
|
290
|
-
...
|
291
|
-
|
292
|
-
populate_input_blobs: __populate_input_blobs_spec
|
293
|
-
|
294
|
-
def get_average_call_time(self) -> float:
|
295
|
-
...
|
296
|
-
|
297
|
-
def get_max_inputs_to_fetch(self):
|
298
|
-
...
|
299
|
-
|
300
|
-
class ___generate_inputs_spec(typing_extensions.Protocol):
|
301
|
-
def __call__(self) -> typing.Iterator[typing.Tuple[str, str, modal_proto.api_pb2.FunctionInput]]:
|
302
|
-
...
|
303
|
-
|
304
|
-
def aio(self) -> typing.AsyncIterator[typing.Tuple[str, str, modal_proto.api_pb2.FunctionInput]]:
|
305
|
-
...
|
306
|
-
|
307
|
-
_generate_inputs: ___generate_inputs_spec
|
308
|
-
|
309
|
-
class __run_inputs_outputs_spec(typing_extensions.Protocol):
|
310
|
-
def __call__(self, input_concurrency: int = 1) -> typing.Iterator[typing.Tuple[str, str, typing.Any, typing.Any]]:
|
311
|
-
...
|
312
|
-
|
313
|
-
def aio(self, input_concurrency: int = 1) -> typing.AsyncIterator[typing.Tuple[str, str, typing.Any, typing.Any]]:
|
314
|
-
...
|
315
|
-
|
316
|
-
run_inputs_outputs: __run_inputs_outputs_spec
|
317
|
-
|
318
|
-
class ___push_output_spec(typing_extensions.Protocol):
|
319
|
-
def __call__(self, input_id, started_at: float, data_format=0, **kwargs):
|
320
|
-
...
|
321
|
-
|
322
|
-
async def aio(self, *args, **kwargs):
|
323
|
-
...
|
324
|
-
|
325
|
-
_push_output: ___push_output_spec
|
326
|
-
|
327
|
-
def serialize_exception(self, exc: BaseException) -> typing.Union[bytes, None]:
|
328
|
-
...
|
329
|
-
|
330
|
-
def serialize_traceback(self, exc: BaseException) -> typing.Tuple[typing.Union[bytes, None], typing.Union[bytes, None]]:
|
331
|
-
...
|
332
|
-
|
333
|
-
class __handle_user_exception_spec(typing_extensions.Protocol):
|
334
|
-
def __call__(self) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
|
335
|
-
...
|
336
|
-
|
337
|
-
def aio(self) -> typing.AsyncContextManager[None]:
|
338
|
-
...
|
339
|
-
|
340
|
-
handle_user_exception: __handle_user_exception_spec
|
341
|
-
|
342
|
-
class __handle_input_exception_spec(typing_extensions.Protocol):
|
343
|
-
def __call__(self, input_id, started_at: float) -> synchronicity.combined_types.AsyncAndBlockingContextManager[None]:
|
344
|
-
...
|
345
|
-
|
346
|
-
def aio(self, input_id, started_at: float) -> typing.AsyncContextManager[None]:
|
347
|
-
...
|
348
|
-
|
349
|
-
handle_input_exception: __handle_input_exception_spec
|
350
|
-
|
351
|
-
class __complete_call_spec(typing_extensions.Protocol):
|
352
|
-
def __call__(self, started_at):
|
353
|
-
...
|
354
|
-
|
355
|
-
async def aio(self, *args, **kwargs):
|
356
|
-
...
|
357
|
-
|
358
|
-
complete_call: __complete_call_spec
|
359
|
-
|
360
|
-
class __push_output_spec(typing_extensions.Protocol):
|
361
|
-
def __call__(self, input_id, started_at: float, data: typing.Any, data_format: int) -> None:
|
362
|
-
...
|
363
|
-
|
364
|
-
async def aio(self, *args, **kwargs) -> None:
|
365
|
-
...
|
366
|
-
|
367
|
-
push_output: __push_output_spec
|
368
|
-
|
369
|
-
class __restore_spec(typing_extensions.Protocol):
|
370
|
-
def __call__(self) -> None:
|
371
|
-
...
|
372
|
-
|
373
|
-
async def aio(self, *args, **kwargs) -> None:
|
374
|
-
...
|
375
|
-
|
376
|
-
restore: __restore_spec
|
377
|
-
|
378
|
-
class __checkpoint_spec(typing_extensions.Protocol):
|
379
|
-
def __call__(self) -> None:
|
380
|
-
...
|
381
|
-
|
382
|
-
async def aio(self, *args, **kwargs) -> None:
|
383
|
-
...
|
384
|
-
|
385
|
-
checkpoint: __checkpoint_spec
|
386
|
-
|
387
|
-
class __volume_commit_spec(typing_extensions.Protocol):
|
388
|
-
def __call__(self, volume_ids: typing.List[str]) -> None:
|
389
|
-
...
|
390
|
-
|
391
|
-
async def aio(self, *args, **kwargs) -> None:
|
392
|
-
...
|
393
|
-
|
394
|
-
volume_commit: __volume_commit_spec
|
395
|
-
|
396
|
-
class __interact_spec(typing_extensions.Protocol):
|
397
|
-
def __call__(self):
|
398
|
-
...
|
399
|
-
|
400
|
-
async def aio(self, *args, **kwargs):
|
401
|
-
...
|
402
|
-
|
403
|
-
interact: __interact_spec
|
404
|
-
|
405
|
-
@classmethod
|
406
|
-
def stop_fetching_inputs(cls):
|
407
|
-
...
|
408
|
-
|
409
|
-
|
410
|
-
MAX_OUTPUT_BATCH_SIZE: int
|
411
|
-
|
412
|
-
RTT_S: float
|
modal/_sandbox_shell.py
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Copyright Modal Labs 2024
|
2
|
-
import asyncio
|
3
|
-
|
4
|
-
from ._utils.shell_utils import connect_to_terminal, write_to_fd
|
5
|
-
from .sandbox import _Sandbox
|
6
|
-
|
7
|
-
|
8
|
-
async def connect_to_sandbox(sandbox: _Sandbox):
|
9
|
-
"""
|
10
|
-
Connects the current terminal to the Sandbox process.
|
11
|
-
"""
|
12
|
-
|
13
|
-
async def _handle_input(data: bytes, _):
|
14
|
-
sandbox.stdin.write(data)
|
15
|
-
await sandbox.stdin.drain.aio() # type: ignore
|
16
|
-
|
17
|
-
async def _stream_to_stdout(on_connect: asyncio.Event) -> int:
|
18
|
-
return await _stream_logs_to_stdout(sandbox, on_connect)
|
19
|
-
|
20
|
-
await connect_to_terminal(_handle_input, _stream_to_stdout, pty=True)
|
21
|
-
|
22
|
-
|
23
|
-
async def _stream_logs_to_stdout(sandbox: _Sandbox, on_connect: asyncio.Event) -> int:
|
24
|
-
"""
|
25
|
-
Streams sandbox output logs to the current terminal's stdout.
|
26
|
-
|
27
|
-
The on_connect event will be set when the client connects to the running process,
|
28
|
-
and the event loop will be released.
|
29
|
-
"""
|
30
|
-
|
31
|
-
# we are connected if we received at least one message from the server
|
32
|
-
# (the server will send an empty message when the process spawns)
|
33
|
-
connected = False
|
34
|
-
|
35
|
-
# Since the sandbox process will run in a PTY, stderr will go to the PTY
|
36
|
-
# slave. The PTY shell will then relay data from PTY master to stdout.
|
37
|
-
# Therefore, we only need to stream from/to stdout here.
|
38
|
-
async for message in sandbox.stdout:
|
39
|
-
await write_to_fd(1, message.encode("utf-8"))
|
40
|
-
|
41
|
-
if not connected:
|
42
|
-
connected = True
|
43
|
-
on_connect.set()
|
44
|
-
# give up the event loop
|
45
|
-
await asyncio.sleep(0)
|
46
|
-
|
47
|
-
# Right now we don't propagate the exit_status to the TaskLogs, so setting
|
48
|
-
# exit status to 0.
|
49
|
-
return 0
|
modal/app_utils.py
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Copyright Modal Labs 2024
|
2
|
-
# Note: this is a temporary module until we've (1) deleted the current app.py (3) renamed stub.py to app.py
|
3
|
-
from typing import List, Optional
|
4
|
-
|
5
|
-
from modal_proto import api_pb2
|
6
|
-
|
7
|
-
from ._utils.async_utils import synchronize_api
|
8
|
-
from .client import _Client
|
9
|
-
from .object import _get_environment_name
|
10
|
-
|
11
|
-
|
12
|
-
async def _list_apps(env: Optional[str] = None, client: Optional[_Client] = None) -> List[api_pb2.AppStats]:
|
13
|
-
"""List apps in a given Modal environment."""
|
14
|
-
if client is None:
|
15
|
-
client = await _Client.from_env()
|
16
|
-
resp: api_pb2.AppListResponse = await client.stub.AppList(api_pb2.AppListRequest(environment_name=_get_environment_name(env)))
|
17
|
-
return list(resp.apps)
|
18
|
-
|
19
|
-
|
20
|
-
list_apps = synchronize_api(_list_apps)
|
modal/app_utils.pyi
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import modal.client
|
2
|
-
import modal_proto.api_pb2
|
3
|
-
import typing
|
4
|
-
import typing_extensions
|
5
|
-
|
6
|
-
async def _list_apps(env: typing.Union[str, None] = None, client: typing.Union[modal.client._Client, None] = None) -> typing.List[modal_proto.api_pb2.AppStats]:
|
7
|
-
...
|
8
|
-
|
9
|
-
|
10
|
-
class __list_apps_spec(typing_extensions.Protocol):
|
11
|
-
def __call__(self, env: typing.Union[str, None] = None, client: typing.Union[modal.client.Client, None] = None) -> typing.List[modal_proto.api_pb2.AppStats]:
|
12
|
-
...
|
13
|
-
|
14
|
-
async def aio(self, *args, **kwargs) -> typing.List[modal_proto.api_pb2.AppStats]:
|
15
|
-
...
|
16
|
-
|
17
|
-
list_apps: __list_apps_spec
|
modal/execution_context.pyi
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
import _contextvars
|
2
|
-
import typing
|
3
|
-
import typing_extensions
|
4
|
-
|
5
|
-
def is_local() -> bool:
|
6
|
-
...
|
7
|
-
|
8
|
-
|
9
|
-
async def _interact() -> None:
|
10
|
-
...
|
11
|
-
|
12
|
-
|
13
|
-
class __interact_spec(typing_extensions.Protocol):
|
14
|
-
def __call__(self) -> None:
|
15
|
-
...
|
16
|
-
|
17
|
-
async def aio(self, *args, **kwargs) -> None:
|
18
|
-
...
|
19
|
-
|
20
|
-
interact: __interact_spec
|
21
|
-
|
22
|
-
|
23
|
-
def current_input_id() -> typing.Union[str, None]:
|
24
|
-
...
|
25
|
-
|
26
|
-
|
27
|
-
def current_function_call_id() -> typing.Union[str, None]:
|
28
|
-
...
|
29
|
-
|
30
|
-
|
31
|
-
def _set_current_context_ids(input_id: str, function_call_id: str) -> typing.Callable[[], None]:
|
32
|
-
...
|
33
|
-
|
34
|
-
|
35
|
-
_current_input_id: _contextvars.ContextVar
|
36
|
-
|
37
|
-
_current_function_call_id: _contextvars.ContextVar
|
modal/shared_volume.py
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Copyright Modal Labs 2023
|
2
|
-
|
3
|
-
from ._utils.async_utils import synchronize_api
|
4
|
-
from .exception import deprecation_error
|
5
|
-
|
6
|
-
|
7
|
-
class _SharedVolume:
|
8
|
-
def __init__(self, *args, **kwargs):
|
9
|
-
"""`SharedVolume` is deprecated. We recommend `Volume` (https://modal.com/docs/guide/volumes) instead."""
|
10
|
-
deprecation_error((2023, 7, 5), _SharedVolume.__init__.__doc__)
|
11
|
-
|
12
|
-
@staticmethod
|
13
|
-
def new(*args, **kwargs):
|
14
|
-
"""`SharedVolume` is deprecated. We recommend `Volume` (https://modal.com/docs/guide/volumes) instead."""
|
15
|
-
deprecation_error((2023, 7, 5), _SharedVolume.new.__doc__)
|
16
|
-
|
17
|
-
@staticmethod
|
18
|
-
def persisted(*args, **kwargs):
|
19
|
-
"""`SharedVolume` is deprecated. We recommend `Volume` (https://modal.com/docs/guide/volumes) instead."""
|
20
|
-
deprecation_error((2023, 7, 5), _SharedVolume.persisted.__doc__)
|
21
|
-
|
22
|
-
|
23
|
-
SharedVolume = synchronize_api(_SharedVolume)
|
modal/shared_volume.pyi
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
class _SharedVolume:
|
2
|
-
def __init__(self, *args, **kwargs):
|
3
|
-
...
|
4
|
-
|
5
|
-
@staticmethod
|
6
|
-
def new(*args, **kwargs):
|
7
|
-
...
|
8
|
-
|
9
|
-
@staticmethod
|
10
|
-
def persisted(*args, **kwargs):
|
11
|
-
...
|
12
|
-
|
13
|
-
|
14
|
-
class SharedVolume:
|
15
|
-
def __init__(self, *args, **kwargs):
|
16
|
-
...
|
17
|
-
|
18
|
-
@staticmethod
|
19
|
-
def new(*args, **kwargs):
|
20
|
-
...
|
21
|
-
|
22
|
-
@staticmethod
|
23
|
-
def persisted(*args, **kwargs):
|
24
|
-
...
|