modal 0.73.26__py3-none-any.whl → 0.73.28__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/_container_entrypoint.py +14 -4
- modal/_functions.py +3 -2
- modal/_partial_function.py +695 -0
- modal/_runtime/container_io_manager.py +3 -17
- modal/_runtime/user_code_imports.py +2 -2
- modal/app.py +6 -6
- modal/client.pyi +2 -2
- modal/cls.py +7 -8
- modal/cls.pyi +2 -1
- modal/experimental.py +1 -1
- modal/functions.pyi +6 -6
- modal/partial_function.py +26 -696
- modal/partial_function.pyi +19 -157
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/METADATA +1 -1
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/RECORD +20 -19
- modal_version/_version_generated.py +1 -1
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/LICENSE +0 -0
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/WHEEL +0 -0
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/entry_points.txt +0 -0
- {modal-0.73.26.dist-info → modal-0.73.28.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,6 @@ import inspect
|
|
5
5
|
import json
|
6
6
|
import math
|
7
7
|
import os
|
8
|
-
import signal
|
9
8
|
import sys
|
10
9
|
import time
|
11
10
|
import traceback
|
@@ -382,22 +381,9 @@ class _ContainerIOManager:
|
|
382
381
|
# response.cancel_input_event.terminate_containers is never set, the server gets the worker to handle it.
|
383
382
|
input_ids_to_cancel = response.cancel_input_event.input_ids
|
384
383
|
if input_ids_to_cancel:
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
self.current_inputs[input_id].cancel()
|
389
|
-
|
390
|
-
elif self.current_input_id and self.current_input_id in input_ids_to_cancel:
|
391
|
-
# This goes to a registered signal handler for sync Modal functions, or to the
|
392
|
-
# `SignalHandlingEventLoop` for async functions.
|
393
|
-
#
|
394
|
-
# We only send this signal on functions that do not have concurrent inputs enabled.
|
395
|
-
# This allows us to do fine-grained input cancellation. On sync functions, the
|
396
|
-
# SIGUSR1 signal should interrupt the main thread where user code is running,
|
397
|
-
# raising an InputCancellation() exception. On async functions, the signal should
|
398
|
-
# reach a handler in SignalHandlingEventLoop, which cancels the task.
|
399
|
-
logger.warning(f"Received a cancellation signal while processing input {self.current_input_id}")
|
400
|
-
os.kill(os.getpid(), signal.SIGUSR1)
|
384
|
+
for input_id in input_ids_to_cancel:
|
385
|
+
if input_id in self.current_inputs:
|
386
|
+
self.current_inputs[input_id].cancel()
|
401
387
|
return True
|
402
388
|
return False
|
403
389
|
|
@@ -10,10 +10,10 @@ import modal._runtime.container_io_manager
|
|
10
10
|
import modal.cls
|
11
11
|
from modal import Function
|
12
12
|
from modal._functions import _Function
|
13
|
+
from modal._partial_function import _find_partial_methods_for_user_cls, _PartialFunctionFlags
|
13
14
|
from modal._utils.async_utils import synchronizer
|
14
15
|
from modal._utils.function_utils import LocalFunctionError, is_async as get_is_async, is_global_object
|
15
16
|
from modal.exception import ExecutionError, InvalidError
|
16
|
-
from modal.partial_function import _find_partial_methods_for_user_cls, _PartialFunctionFlags
|
17
17
|
from modal_proto import api_pb2
|
18
18
|
|
19
19
|
if typing.TYPE_CHECKING:
|
@@ -139,7 +139,7 @@ class ImportedClass(Service):
|
|
139
139
|
app: Optional["modal.app._App"]
|
140
140
|
code_deps: Optional[Sequence["modal._object._Object"]]
|
141
141
|
|
142
|
-
_partial_functions: dict[str, "modal.
|
142
|
+
_partial_functions: dict[str, "modal._partial_function._PartialFunction"]
|
143
143
|
|
144
144
|
def get_finalized_functions(
|
145
145
|
self, fun_def: api_pb2.Function, container_io_manager: "modal._runtime.container_io_manager.ContainerIOManager"
|
modal/app.py
CHANGED
@@ -23,6 +23,11 @@ from modal_proto import api_pb2
|
|
23
23
|
from ._functions import _Function
|
24
24
|
from ._ipython import is_notebook
|
25
25
|
from ._object import _get_environment_name, _Object
|
26
|
+
from ._partial_function import (
|
27
|
+
_find_partial_methods_for_user_cls,
|
28
|
+
_PartialFunction,
|
29
|
+
_PartialFunctionFlags,
|
30
|
+
)
|
26
31
|
from ._utils.async_utils import synchronize_api
|
27
32
|
from ._utils.deprecation import deprecation_error, deprecation_warning, renamed_parameter
|
28
33
|
from ._utils.function_utils import FunctionInfo, is_global_object, is_method_fn
|
@@ -38,12 +43,7 @@ from .gpu import GPU_T
|
|
38
43
|
from .image import _Image
|
39
44
|
from .mount import _Mount
|
40
45
|
from .network_file_system import _NetworkFileSystem
|
41
|
-
from .partial_function import
|
42
|
-
PartialFunction,
|
43
|
-
_find_partial_methods_for_user_cls,
|
44
|
-
_PartialFunction,
|
45
|
-
_PartialFunctionFlags,
|
46
|
-
)
|
46
|
+
from .partial_function import PartialFunction
|
47
47
|
from .proxy import _Proxy
|
48
48
|
from .retries import Retries
|
49
49
|
from .running_app import RunningApp
|
modal/client.pyi
CHANGED
@@ -27,7 +27,7 @@ class _Client:
|
|
27
27
|
_snapshotted: bool
|
28
28
|
|
29
29
|
def __init__(
|
30
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.
|
30
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.28"
|
31
31
|
): ...
|
32
32
|
def is_closed(self) -> bool: ...
|
33
33
|
@property
|
@@ -85,7 +85,7 @@ class Client:
|
|
85
85
|
_snapshotted: bool
|
86
86
|
|
87
87
|
def __init__(
|
88
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.
|
88
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.73.28"
|
89
89
|
): ...
|
90
90
|
def is_closed(self) -> bool: ...
|
91
91
|
@property
|
modal/cls.py
CHANGED
@@ -13,6 +13,12 @@ from modal_proto import api_pb2
|
|
13
13
|
|
14
14
|
from ._functions import _Function, _parse_retries
|
15
15
|
from ._object import _Object
|
16
|
+
from ._partial_function import (
|
17
|
+
_find_callables_for_obj,
|
18
|
+
_find_partial_methods_for_user_cls,
|
19
|
+
_PartialFunction,
|
20
|
+
_PartialFunctionFlags,
|
21
|
+
)
|
16
22
|
from ._resolver import Resolver
|
17
23
|
from ._resources import convert_fn_config_to_resources_config
|
18
24
|
from ._serialization import check_valid_cls_constructor_arg
|
@@ -25,12 +31,6 @@ from .client import _Client
|
|
25
31
|
from .config import config
|
26
32
|
from .exception import ExecutionError, InvalidError, NotFoundError
|
27
33
|
from .gpu import GPU_T
|
28
|
-
from .partial_function import (
|
29
|
-
_find_callables_for_obj,
|
30
|
-
_find_partial_methods_for_user_cls,
|
31
|
-
_PartialFunction,
|
32
|
-
_PartialFunctionFlags,
|
33
|
-
)
|
34
34
|
from .retries import Retries
|
35
35
|
from .secret import _Secret
|
36
36
|
from .volume import _Volume
|
@@ -674,8 +674,7 @@ class _Cls(_Object, type_prefix="cs"):
|
|
674
674
|
)
|
675
675
|
|
676
676
|
def __getattr__(self, k):
|
677
|
-
#
|
678
|
-
# TODO: remove this method - access to attributes on classes should be discouraged
|
677
|
+
# TODO: remove this method - access to attributes on classes (not instances) should be discouraged
|
679
678
|
if k in self._method_functions:
|
680
679
|
deprecation_warning(
|
681
680
|
(2025, 1, 13),
|
modal/cls.pyi
CHANGED
@@ -3,6 +3,7 @@ import google.protobuf.message
|
|
3
3
|
import inspect
|
4
4
|
import modal._functions
|
5
5
|
import modal._object
|
6
|
+
import modal._partial_function
|
6
7
|
import modal.app
|
7
8
|
import modal.client
|
8
9
|
import modal.functions
|
@@ -104,7 +105,7 @@ class _Cls(modal._object._Object):
|
|
104
105
|
|
105
106
|
def _initialize_from_empty(self): ...
|
106
107
|
def _initialize_from_other(self, other: _Cls): ...
|
107
|
-
def _get_partial_functions(self) -> dict[str, modal.
|
108
|
+
def _get_partial_functions(self) -> dict[str, modal._partial_function._PartialFunction]: ...
|
108
109
|
def _get_app(self) -> modal.app._App: ...
|
109
110
|
def _get_user_cls(self) -> type: ...
|
110
111
|
def _get_name(self) -> str: ...
|
modal/experimental.py
CHANGED
@@ -7,11 +7,11 @@ from modal_proto import api_pb2
|
|
7
7
|
from ._clustered_functions import ClusterInfo, get_cluster_info as _get_cluster_info
|
8
8
|
from ._functions import _Function
|
9
9
|
from ._object import _get_environment_name
|
10
|
+
from ._partial_function import _PartialFunction, _PartialFunctionFlags
|
10
11
|
from ._runtime.container_io_manager import _ContainerIOManager
|
11
12
|
from ._utils.async_utils import synchronizer
|
12
13
|
from .client import _Client
|
13
14
|
from .exception import InvalidError
|
14
|
-
from .partial_function import _PartialFunction, _PartialFunctionFlags
|
15
15
|
|
16
16
|
|
17
17
|
def stop_fetching_inputs():
|
modal/functions.pyi
CHANGED
@@ -200,11 +200,11 @@ class Function(
|
|
200
200
|
|
201
201
|
_call_generator_nowait: ___call_generator_nowait_spec[typing_extensions.Self]
|
202
202
|
|
203
|
-
class __remote_spec(typing_extensions.Protocol[
|
203
|
+
class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
204
204
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
205
205
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
|
206
206
|
|
207
|
-
remote: __remote_spec[modal._functions.
|
207
|
+
remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
208
208
|
|
209
209
|
class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
210
210
|
def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
|
@@ -219,19 +219,19 @@ class Function(
|
|
219
219
|
self, *args: modal._functions.P.args, **kwargs: modal._functions.P.kwargs
|
220
220
|
) -> modal._functions.OriginalReturnType: ...
|
221
221
|
|
222
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
222
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
223
223
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
224
224
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
225
225
|
|
226
226
|
_experimental_spawn: ___experimental_spawn_spec[
|
227
|
-
modal._functions.
|
227
|
+
modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
|
228
228
|
]
|
229
229
|
|
230
|
-
class __spawn_spec(typing_extensions.Protocol[
|
230
|
+
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
231
231
|
def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
232
232
|
async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
|
233
233
|
|
234
|
-
spawn: __spawn_spec[modal._functions.
|
234
|
+
spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
235
235
|
|
236
236
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
|
237
237
|
|