modal 1.0.3.dev10__py3-none-any.whl → 1.2.3.dev7__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 +0 -2
- modal/__main__.py +3 -4
- modal/_billing.py +80 -0
- modal/_clustered_functions.py +7 -3
- modal/_clustered_functions.pyi +15 -3
- modal/_container_entrypoint.py +51 -69
- modal/_functions.py +508 -240
- modal/_grpc_client.py +171 -0
- modal/_load_context.py +105 -0
- modal/_object.py +81 -21
- modal/_output.py +58 -45
- modal/_partial_function.py +48 -73
- modal/_pty.py +7 -3
- modal/_resolver.py +26 -46
- modal/_runtime/asgi.py +4 -3
- modal/_runtime/container_io_manager.py +358 -220
- modal/_runtime/container_io_manager.pyi +296 -101
- modal/_runtime/execution_context.py +18 -2
- modal/_runtime/execution_context.pyi +64 -7
- modal/_runtime/gpu_memory_snapshot.py +262 -57
- modal/_runtime/user_code_imports.py +28 -58
- modal/_serialization.py +90 -6
- modal/_traceback.py +42 -1
- modal/_tunnel.pyi +380 -12
- modal/_utils/async_utils.py +84 -29
- modal/_utils/auth_token_manager.py +111 -0
- modal/_utils/blob_utils.py +181 -58
- modal/_utils/deprecation.py +19 -0
- modal/_utils/function_utils.py +91 -47
- modal/_utils/grpc_utils.py +89 -66
- modal/_utils/mount_utils.py +26 -1
- modal/_utils/name_utils.py +17 -3
- modal/_utils/task_command_router_client.py +536 -0
- modal/_utils/time_utils.py +34 -6
- modal/app.py +256 -88
- modal/app.pyi +909 -92
- modal/billing.py +5 -0
- modal/builder/2025.06.txt +18 -0
- modal/builder/PREVIEW.txt +18 -0
- modal/builder/base-images.json +58 -0
- modal/cli/_download.py +19 -3
- modal/cli/_traceback.py +3 -2
- modal/cli/app.py +4 -4
- modal/cli/cluster.py +15 -7
- modal/cli/config.py +5 -3
- modal/cli/container.py +7 -6
- modal/cli/dict.py +22 -16
- modal/cli/entry_point.py +12 -5
- modal/cli/environment.py +5 -4
- modal/cli/import_refs.py +3 -3
- modal/cli/launch.py +102 -5
- modal/cli/network_file_system.py +11 -12
- modal/cli/profile.py +3 -2
- modal/cli/programs/launch_instance_ssh.py +94 -0
- modal/cli/programs/run_jupyter.py +1 -1
- modal/cli/programs/run_marimo.py +95 -0
- modal/cli/programs/vscode.py +1 -1
- modal/cli/queues.py +57 -26
- modal/cli/run.py +91 -23
- modal/cli/secret.py +48 -22
- modal/cli/token.py +7 -8
- modal/cli/utils.py +4 -7
- modal/cli/volume.py +31 -25
- modal/client.py +15 -85
- modal/client.pyi +183 -62
- modal/cloud_bucket_mount.py +5 -3
- modal/cloud_bucket_mount.pyi +197 -5
- modal/cls.py +200 -126
- modal/cls.pyi +446 -68
- modal/config.py +29 -11
- modal/container_process.py +319 -19
- modal/container_process.pyi +190 -20
- modal/dict.py +290 -71
- modal/dict.pyi +835 -83
- modal/environments.py +15 -27
- modal/environments.pyi +46 -24
- modal/exception.py +14 -2
- modal/experimental/__init__.py +194 -40
- modal/experimental/flash.py +618 -0
- modal/experimental/flash.pyi +380 -0
- modal/experimental/ipython.py +11 -7
- modal/file_io.py +29 -36
- modal/file_io.pyi +251 -53
- modal/file_pattern_matcher.py +56 -16
- modal/functions.pyi +673 -92
- modal/gpu.py +1 -1
- modal/image.py +528 -176
- modal/image.pyi +1572 -145
- modal/io_streams.py +458 -128
- modal/io_streams.pyi +433 -52
- modal/mount.py +216 -151
- modal/mount.pyi +225 -78
- modal/network_file_system.py +45 -62
- modal/network_file_system.pyi +277 -56
- modal/object.pyi +93 -17
- modal/parallel_map.py +942 -129
- modal/parallel_map.pyi +294 -15
- modal/partial_function.py +0 -2
- modal/partial_function.pyi +234 -19
- modal/proxy.py +17 -8
- modal/proxy.pyi +36 -3
- modal/queue.py +270 -65
- modal/queue.pyi +817 -57
- modal/runner.py +115 -101
- modal/runner.pyi +205 -49
- modal/sandbox.py +512 -136
- modal/sandbox.pyi +845 -111
- modal/schedule.py +1 -1
- modal/secret.py +300 -70
- modal/secret.pyi +589 -34
- modal/serving.py +7 -11
- modal/serving.pyi +7 -8
- modal/snapshot.py +11 -8
- modal/snapshot.pyi +25 -4
- modal/token_flow.py +4 -4
- modal/token_flow.pyi +28 -8
- modal/volume.py +416 -158
- modal/volume.pyi +1117 -121
- {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/METADATA +10 -9
- modal-1.2.3.dev7.dist-info/RECORD +195 -0
- modal_docs/mdmd/mdmd.py +17 -4
- modal_proto/api.proto +534 -79
- modal_proto/api_grpc.py +337 -1
- modal_proto/api_pb2.py +1522 -968
- modal_proto/api_pb2.pyi +1619 -134
- modal_proto/api_pb2_grpc.py +699 -4
- modal_proto/api_pb2_grpc.pyi +226 -14
- modal_proto/modal_api_grpc.py +175 -154
- modal_proto/sandbox_router.proto +145 -0
- modal_proto/sandbox_router_grpc.py +105 -0
- modal_proto/sandbox_router_pb2.py +149 -0
- modal_proto/sandbox_router_pb2.pyi +333 -0
- modal_proto/sandbox_router_pb2_grpc.py +203 -0
- modal_proto/sandbox_router_pb2_grpc.pyi +75 -0
- modal_proto/task_command_router.proto +144 -0
- modal_proto/task_command_router_grpc.py +105 -0
- modal_proto/task_command_router_pb2.py +149 -0
- modal_proto/task_command_router_pb2.pyi +333 -0
- modal_proto/task_command_router_pb2_grpc.py +203 -0
- modal_proto/task_command_router_pb2_grpc.pyi +75 -0
- modal_version/__init__.py +1 -1
- modal/requirements/PREVIEW.txt +0 -16
- modal/requirements/base-images.json +0 -26
- modal-1.0.3.dev10.dist-info/RECORD +0 -179
- 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/{requirements → builder}/2023.12.312.txt +0 -0
- /modal/{requirements → builder}/2023.12.txt +0 -0
- /modal/{requirements → builder}/2024.04.txt +0 -0
- /modal/{requirements → builder}/2024.10.txt +0 -0
- /modal/{requirements → builder}/README.md +0 -0
- {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/WHEEL +0 -0
- {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/entry_points.txt +0 -0
- {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/licenses/LICENSE +0 -0
- {modal-1.0.3.dev10.dist-info → modal-1.2.3.dev7.dist-info}/top_level.txt +0 -0
modal/container_process.pyi
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import modal._utils.task_command_router_client
|
|
1
2
|
import modal.client
|
|
2
3
|
import modal.io_streams
|
|
3
4
|
import modal.stream_type
|
|
@@ -6,11 +7,32 @@ import typing_extensions
|
|
|
6
7
|
|
|
7
8
|
T = typing.TypeVar("T")
|
|
8
9
|
|
|
9
|
-
class
|
|
10
|
+
class _ContainerProcessThroughServer(typing.Generic[T]):
|
|
11
|
+
"""Abstract base class for generic types.
|
|
12
|
+
|
|
13
|
+
A generic type is typically declared by inheriting from
|
|
14
|
+
this class parameterized with one or more type variables.
|
|
15
|
+
For example, a generic mapping type might be defined as::
|
|
16
|
+
|
|
17
|
+
class Mapping(Generic[KT, VT]):
|
|
18
|
+
def __getitem__(self, key: KT) -> VT:
|
|
19
|
+
...
|
|
20
|
+
# Etc.
|
|
21
|
+
|
|
22
|
+
This class can then be used as follows::
|
|
23
|
+
|
|
24
|
+
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
|
|
25
|
+
try:
|
|
26
|
+
return mapping[key]
|
|
27
|
+
except KeyError:
|
|
28
|
+
return default
|
|
29
|
+
"""
|
|
30
|
+
|
|
10
31
|
_process_id: typing.Optional[str]
|
|
11
32
|
_stdout: modal.io_streams._StreamReader[T]
|
|
12
33
|
_stderr: modal.io_streams._StreamReader[T]
|
|
13
34
|
_stdin: modal.io_streams._StreamWriter
|
|
35
|
+
_exec_deadline: typing.Optional[float]
|
|
14
36
|
_text: bool
|
|
15
37
|
_by_line: bool
|
|
16
38
|
_returncode: typing.Optional[int]
|
|
@@ -18,13 +40,82 @@ class _ContainerProcess(typing.Generic[T]):
|
|
|
18
40
|
def __init__(
|
|
19
41
|
self,
|
|
20
42
|
process_id: str,
|
|
43
|
+
task_id: str,
|
|
21
44
|
client: modal.client._Client,
|
|
22
45
|
stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
23
46
|
stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
47
|
+
exec_deadline: typing.Optional[float] = None,
|
|
24
48
|
text: bool = True,
|
|
25
49
|
by_line: bool = False,
|
|
26
|
-
) -> None:
|
|
27
|
-
|
|
50
|
+
) -> None:
|
|
51
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
52
|
+
...
|
|
53
|
+
|
|
54
|
+
def __repr__(self) -> str:
|
|
55
|
+
"""Return repr(self)."""
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def stdout(self) -> modal.io_streams._StreamReader[T]:
|
|
60
|
+
"""StreamReader for the container process's stdout stream."""
|
|
61
|
+
...
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def stderr(self) -> modal.io_streams._StreamReader[T]:
|
|
65
|
+
"""StreamReader for the container process's stderr stream."""
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def stdin(self) -> modal.io_streams._StreamWriter:
|
|
70
|
+
"""StreamWriter for the container process's stdin stream."""
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def returncode(self) -> int: ...
|
|
75
|
+
async def poll(self) -> typing.Optional[int]:
|
|
76
|
+
"""Check if the container process has finished running.
|
|
77
|
+
|
|
78
|
+
Returns `None` if the process is still running, else returns the exit code.
|
|
79
|
+
"""
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
async def _wait_for_completion(self) -> int: ...
|
|
83
|
+
async def wait(self) -> int:
|
|
84
|
+
"""Wait for the container process to finish running. Returns the exit code."""
|
|
85
|
+
...
|
|
86
|
+
|
|
87
|
+
async def attach(self):
|
|
88
|
+
"""mdmd:hidden"""
|
|
89
|
+
...
|
|
90
|
+
|
|
91
|
+
def _iter_stream_as_bytes(stream: modal.io_streams._StreamReader[T]):
|
|
92
|
+
"""Yield raw bytes from a StreamReader regardless of text mode/backend."""
|
|
93
|
+
...
|
|
94
|
+
|
|
95
|
+
class _ContainerProcessThroughCommandRouter(typing.Generic[T]):
|
|
96
|
+
"""Container process implementation that works via direct communication with
|
|
97
|
+
the Modal worker where the container is running.
|
|
98
|
+
"""
|
|
99
|
+
def __init__(
|
|
100
|
+
self,
|
|
101
|
+
process_id: str,
|
|
102
|
+
client: modal.client._Client,
|
|
103
|
+
command_router_client: modal._utils.task_command_router_client.TaskCommandRouterClient,
|
|
104
|
+
task_id: str,
|
|
105
|
+
*,
|
|
106
|
+
stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
107
|
+
stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
108
|
+
exec_deadline: typing.Optional[float] = None,
|
|
109
|
+
text: bool = True,
|
|
110
|
+
by_line: bool = False,
|
|
111
|
+
) -> None:
|
|
112
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
def __repr__(self) -> str:
|
|
116
|
+
"""Return repr(self)."""
|
|
117
|
+
...
|
|
118
|
+
|
|
28
119
|
@property
|
|
29
120
|
def stdout(self) -> modal.io_streams._StreamReader[T]: ...
|
|
30
121
|
@property
|
|
@@ -37,50 +128,129 @@ class _ContainerProcess(typing.Generic[T]):
|
|
|
37
128
|
async def wait(self) -> int: ...
|
|
38
129
|
async def attach(self): ...
|
|
39
130
|
|
|
131
|
+
class _ContainerProcess(typing.Generic[T]):
|
|
132
|
+
"""Represents a running process in a container."""
|
|
133
|
+
def __init__(
|
|
134
|
+
self,
|
|
135
|
+
process_id: str,
|
|
136
|
+
task_id: str,
|
|
137
|
+
client: modal.client._Client,
|
|
138
|
+
stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
139
|
+
stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
140
|
+
exec_deadline: typing.Optional[float] = None,
|
|
141
|
+
text: bool = True,
|
|
142
|
+
by_line: bool = False,
|
|
143
|
+
command_router_client: typing.Optional[modal._utils.task_command_router_client.TaskCommandRouterClient] = None,
|
|
144
|
+
) -> None:
|
|
145
|
+
"""Initialize self. See help(type(self)) for accurate signature."""
|
|
146
|
+
...
|
|
147
|
+
|
|
148
|
+
def __repr__(self) -> str:
|
|
149
|
+
"""Return repr(self)."""
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def stdout(self) -> modal.io_streams._StreamReader[T]:
|
|
154
|
+
"""StreamReader for the container process's stdout stream."""
|
|
155
|
+
...
|
|
156
|
+
|
|
157
|
+
@property
|
|
158
|
+
def stderr(self) -> modal.io_streams._StreamReader[T]:
|
|
159
|
+
"""StreamReader for the container process's stderr stream."""
|
|
160
|
+
...
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def stdin(self) -> modal.io_streams._StreamWriter:
|
|
164
|
+
"""StreamWriter for the container process's stdin stream."""
|
|
165
|
+
...
|
|
166
|
+
|
|
167
|
+
@property
|
|
168
|
+
def returncode(self) -> int: ...
|
|
169
|
+
async def poll(self) -> typing.Optional[int]:
|
|
170
|
+
"""Check if the container process has finished running.
|
|
171
|
+
|
|
172
|
+
Returns `None` if the process is still running, else returns the exit code.
|
|
173
|
+
"""
|
|
174
|
+
...
|
|
175
|
+
|
|
176
|
+
async def wait(self) -> int:
|
|
177
|
+
"""Wait for the container process to finish running. Returns the exit code."""
|
|
178
|
+
...
|
|
179
|
+
|
|
180
|
+
async def attach(self):
|
|
181
|
+
"""mdmd:hidden"""
|
|
182
|
+
...
|
|
183
|
+
|
|
40
184
|
SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
|
|
41
185
|
|
|
42
186
|
class ContainerProcess(typing.Generic[T]):
|
|
43
|
-
|
|
44
|
-
_stdout: modal.io_streams.StreamReader[T]
|
|
45
|
-
_stderr: modal.io_streams.StreamReader[T]
|
|
46
|
-
_stdin: modal.io_streams.StreamWriter
|
|
47
|
-
_text: bool
|
|
48
|
-
_by_line: bool
|
|
49
|
-
_returncode: typing.Optional[int]
|
|
50
|
-
|
|
187
|
+
"""Represents a running process in a container."""
|
|
51
188
|
def __init__(
|
|
52
189
|
self,
|
|
53
190
|
process_id: str,
|
|
191
|
+
task_id: str,
|
|
54
192
|
client: modal.client.Client,
|
|
55
193
|
stdout: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
56
194
|
stderr: modal.stream_type.StreamType = modal.stream_type.StreamType.PIPE,
|
|
195
|
+
exec_deadline: typing.Optional[float] = None,
|
|
57
196
|
text: bool = True,
|
|
58
197
|
by_line: bool = False,
|
|
198
|
+
command_router_client: typing.Optional[modal._utils.task_command_router_client.TaskCommandRouterClient] = None,
|
|
59
199
|
) -> None: ...
|
|
60
200
|
def __repr__(self) -> str: ...
|
|
61
201
|
@property
|
|
62
|
-
def stdout(self) -> modal.io_streams.StreamReader[T]:
|
|
202
|
+
def stdout(self) -> modal.io_streams.StreamReader[T]:
|
|
203
|
+
"""StreamReader for the container process's stdout stream."""
|
|
204
|
+
...
|
|
205
|
+
|
|
63
206
|
@property
|
|
64
|
-
def stderr(self) -> modal.io_streams.StreamReader[T]:
|
|
207
|
+
def stderr(self) -> modal.io_streams.StreamReader[T]:
|
|
208
|
+
"""StreamReader for the container process's stderr stream."""
|
|
209
|
+
...
|
|
210
|
+
|
|
65
211
|
@property
|
|
66
|
-
def stdin(self) -> modal.io_streams.StreamWriter:
|
|
212
|
+
def stdin(self) -> modal.io_streams.StreamWriter:
|
|
213
|
+
"""StreamWriter for the container process's stdin stream."""
|
|
214
|
+
...
|
|
215
|
+
|
|
67
216
|
@property
|
|
68
217
|
def returncode(self) -> int: ...
|
|
69
218
|
|
|
70
219
|
class __poll_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
71
|
-
def __call__(self, /) -> typing.Optional[int]:
|
|
72
|
-
|
|
220
|
+
def __call__(self, /) -> typing.Optional[int]:
|
|
221
|
+
"""Check if the container process has finished running.
|
|
222
|
+
|
|
223
|
+
Returns `None` if the process is still running, else returns the exit code.
|
|
224
|
+
"""
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
async def aio(self, /) -> typing.Optional[int]:
|
|
228
|
+
"""Check if the container process has finished running.
|
|
229
|
+
|
|
230
|
+
Returns `None` if the process is still running, else returns the exit code.
|
|
231
|
+
"""
|
|
232
|
+
...
|
|
73
233
|
|
|
74
234
|
poll: __poll_spec[typing_extensions.Self]
|
|
75
235
|
|
|
76
236
|
class __wait_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
77
|
-
def __call__(self, /) -> int:
|
|
78
|
-
|
|
237
|
+
def __call__(self, /) -> int:
|
|
238
|
+
"""Wait for the container process to finish running. Returns the exit code."""
|
|
239
|
+
...
|
|
240
|
+
|
|
241
|
+
async def aio(self, /) -> int:
|
|
242
|
+
"""Wait for the container process to finish running. Returns the exit code."""
|
|
243
|
+
...
|
|
79
244
|
|
|
80
245
|
wait: __wait_spec[typing_extensions.Self]
|
|
81
246
|
|
|
82
247
|
class __attach_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
83
|
-
def __call__(self, /):
|
|
84
|
-
|
|
248
|
+
def __call__(self, /):
|
|
249
|
+
"""mdmd:hidden"""
|
|
250
|
+
...
|
|
251
|
+
|
|
252
|
+
async def aio(self, /):
|
|
253
|
+
"""mdmd:hidden"""
|
|
254
|
+
...
|
|
85
255
|
|
|
86
256
|
attach: __attach_spec[typing_extensions.Self]
|