modal 0.71.7__py3-none-any.whl → 0.71.12__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 +13 -3
- modal/_runtime/asgi.py +33 -29
- modal/cli/volume.py +23 -0
- modal/client.pyi +2 -2
- modal/file_io.py +101 -83
- modal/file_io.pyi +4 -23
- modal/io_streams.py +27 -15
- modal/volume.py +12 -0
- modal/volume.pyi +28 -0
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/METADATA +1 -1
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/RECORD +23 -24
- modal_proto/api.proto +6 -0
- modal_proto/api_grpc.py +16 -0
- modal_proto/api_pb2.py +83 -71
- modal_proto/api_pb2.pyi +17 -0
- modal_proto/api_pb2_grpc.py +33 -0
- modal_proto/api_pb2_grpc.pyi +10 -0
- modal_proto/modal_api_grpc.py +1 -0
- modal_version/_version_generated.py +1 -1
- modal/io_streams_helper.py +0 -53
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/LICENSE +0 -0
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/WHEEL +0 -0
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/entry_points.txt +0 -0
- {modal-0.71.7.dist-info → modal-0.71.12.dist-info}/top_level.txt +0 -0
modal_proto/api_pb2.pyi
CHANGED
@@ -8731,6 +8731,23 @@ class VolumeRemoveFileRequest(google.protobuf.message.Message):
|
|
8731
8731
|
|
8732
8732
|
global___VolumeRemoveFileRequest = VolumeRemoveFileRequest
|
8733
8733
|
|
8734
|
+
class VolumeRenameRequest(google.protobuf.message.Message):
|
8735
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
8736
|
+
|
8737
|
+
VOLUME_ID_FIELD_NUMBER: builtins.int
|
8738
|
+
NAME_FIELD_NUMBER: builtins.int
|
8739
|
+
volume_id: builtins.str
|
8740
|
+
name: builtins.str
|
8741
|
+
def __init__(
|
8742
|
+
self,
|
8743
|
+
*,
|
8744
|
+
volume_id: builtins.str = ...,
|
8745
|
+
name: builtins.str = ...,
|
8746
|
+
) -> None: ...
|
8747
|
+
def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "volume_id", b"volume_id"]) -> None: ...
|
8748
|
+
|
8749
|
+
global___VolumeRenameRequest = VolumeRenameRequest
|
8750
|
+
|
8734
8751
|
class Warning(google.protobuf.message.Message):
|
8735
8752
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
8736
8753
|
|
modal_proto/api_pb2_grpc.py
CHANGED
@@ -680,6 +680,11 @@ class ModalClientStub(object):
|
|
680
680
|
request_serializer=modal__proto_dot_api__pb2.VolumeRemoveFileRequest.SerializeToString,
|
681
681
|
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
682
682
|
)
|
683
|
+
self.VolumeRename = channel.unary_unary(
|
684
|
+
'/modal.client.ModalClient/VolumeRename',
|
685
|
+
request_serializer=modal__proto_dot_api__pb2.VolumeRenameRequest.SerializeToString,
|
686
|
+
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
687
|
+
)
|
683
688
|
self.WorkspaceNameLookup = channel.unary_unary(
|
684
689
|
'/modal.client.ModalClient/WorkspaceNameLookup',
|
685
690
|
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
@@ -1512,6 +1517,12 @@ class ModalClientServicer(object):
|
|
1512
1517
|
context.set_details('Method not implemented!')
|
1513
1518
|
raise NotImplementedError('Method not implemented!')
|
1514
1519
|
|
1520
|
+
def VolumeRename(self, request, context):
|
1521
|
+
"""Missing associated documentation comment in .proto file."""
|
1522
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
1523
|
+
context.set_details('Method not implemented!')
|
1524
|
+
raise NotImplementedError('Method not implemented!')
|
1525
|
+
|
1515
1526
|
def WorkspaceNameLookup(self, request, context):
|
1516
1527
|
"""Workspaces
|
1517
1528
|
"""
|
@@ -2187,6 +2198,11 @@ def add_ModalClientServicer_to_server(servicer, server):
|
|
2187
2198
|
request_deserializer=modal__proto_dot_api__pb2.VolumeRemoveFileRequest.FromString,
|
2188
2199
|
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
2189
2200
|
),
|
2201
|
+
'VolumeRename': grpc.unary_unary_rpc_method_handler(
|
2202
|
+
servicer.VolumeRename,
|
2203
|
+
request_deserializer=modal__proto_dot_api__pb2.VolumeRenameRequest.FromString,
|
2204
|
+
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
2205
|
+
),
|
2190
2206
|
'WorkspaceNameLookup': grpc.unary_unary_rpc_method_handler(
|
2191
2207
|
servicer.WorkspaceNameLookup,
|
2192
2208
|
request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
@@ -4463,6 +4479,23 @@ class ModalClient(object):
|
|
4463
4479
|
options, channel_credentials,
|
4464
4480
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
4465
4481
|
|
4482
|
+
@staticmethod
|
4483
|
+
def VolumeRename(request,
|
4484
|
+
target,
|
4485
|
+
options=(),
|
4486
|
+
channel_credentials=None,
|
4487
|
+
call_credentials=None,
|
4488
|
+
insecure=False,
|
4489
|
+
compression=None,
|
4490
|
+
wait_for_ready=None,
|
4491
|
+
timeout=None,
|
4492
|
+
metadata=None):
|
4493
|
+
return grpc.experimental.unary_unary(request, target, '/modal.client.ModalClient/VolumeRename',
|
4494
|
+
modal__proto_dot_api__pb2.VolumeRenameRequest.SerializeToString,
|
4495
|
+
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
4496
|
+
options, channel_credentials,
|
4497
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
4498
|
+
|
4466
4499
|
@staticmethod
|
4467
4500
|
def WorkspaceNameLookup(request,
|
4468
4501
|
target,
|
modal_proto/api_pb2_grpc.pyi
CHANGED
@@ -566,6 +566,10 @@ class ModalClientStub:
|
|
566
566
|
modal_proto.api_pb2.VolumeRemoveFileRequest,
|
567
567
|
google.protobuf.empty_pb2.Empty,
|
568
568
|
]
|
569
|
+
VolumeRename: grpc.UnaryUnaryMultiCallable[
|
570
|
+
modal_proto.api_pb2.VolumeRenameRequest,
|
571
|
+
google.protobuf.empty_pb2.Empty,
|
572
|
+
]
|
569
573
|
WorkspaceNameLookup: grpc.UnaryUnaryMultiCallable[
|
570
574
|
google.protobuf.empty_pb2.Empty,
|
571
575
|
modal_proto.api_pb2.WorkspaceNameLookupResponse,
|
@@ -1396,6 +1400,12 @@ class ModalClientServicer(metaclass=abc.ABCMeta):
|
|
1396
1400
|
context: grpc.ServicerContext,
|
1397
1401
|
) -> google.protobuf.empty_pb2.Empty: ...
|
1398
1402
|
@abc.abstractmethod
|
1403
|
+
def VolumeRename(
|
1404
|
+
self,
|
1405
|
+
request: modal_proto.api_pb2.VolumeRenameRequest,
|
1406
|
+
context: grpc.ServicerContext,
|
1407
|
+
) -> google.protobuf.empty_pb2.Empty: ...
|
1408
|
+
@abc.abstractmethod
|
1399
1409
|
def WorkspaceNameLookup(
|
1400
1410
|
self,
|
1401
1411
|
request: google.protobuf.empty_pb2.Empty,
|
modal_proto/modal_api_grpc.py
CHANGED
@@ -145,4 +145,5 @@ class ModalClientModal:
|
|
145
145
|
self.VolumePutFiles = modal.client.UnaryUnaryWrapper(grpclib_stub.VolumePutFiles, client)
|
146
146
|
self.VolumeReload = modal.client.UnaryUnaryWrapper(grpclib_stub.VolumeReload, client)
|
147
147
|
self.VolumeRemoveFile = modal.client.UnaryUnaryWrapper(grpclib_stub.VolumeRemoveFile, client)
|
148
|
+
self.VolumeRename = modal.client.UnaryUnaryWrapper(grpclib_stub.VolumeRename, client)
|
148
149
|
self.WorkspaceNameLookup = modal.client.UnaryUnaryWrapper(grpclib_stub.WorkspaceNameLookup, client)
|
modal/io_streams_helper.py
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Copyright Modal Labs 2024
|
2
|
-
import asyncio
|
3
|
-
from typing import AsyncIterator, Callable, TypeVar
|
4
|
-
|
5
|
-
from grpclib.exceptions import GRPCError, StreamTerminatedError
|
6
|
-
|
7
|
-
from modal.exception import ClientClosed
|
8
|
-
|
9
|
-
from ._utils.grpc_utils import RETRYABLE_GRPC_STATUS_CODES
|
10
|
-
|
11
|
-
T = TypeVar("T")
|
12
|
-
|
13
|
-
|
14
|
-
async def consume_stream_with_retries(
|
15
|
-
stream: AsyncIterator[T],
|
16
|
-
item_handler: Callable[[T], None],
|
17
|
-
completion_check: Callable[[T], bool],
|
18
|
-
max_retries: int = 10,
|
19
|
-
retry_delay: float = 1.0,
|
20
|
-
) -> None:
|
21
|
-
"""mdmd:hidden
|
22
|
-
Helper function to consume a stream with retry logic for transient errors.
|
23
|
-
|
24
|
-
Args:
|
25
|
-
stream_generator: Function that returns an AsyncIterator to consume
|
26
|
-
item_handler: Callback function to handle each item from the stream
|
27
|
-
completion_check: Callback function to check if the stream is complete
|
28
|
-
max_retries: Maximum number of retry attempts
|
29
|
-
retry_delay: Delay in seconds between retries
|
30
|
-
"""
|
31
|
-
completed = False
|
32
|
-
retries_remaining = max_retries
|
33
|
-
|
34
|
-
while not completed:
|
35
|
-
try:
|
36
|
-
async for item in stream:
|
37
|
-
item_handler(item)
|
38
|
-
if completion_check(item):
|
39
|
-
completed = True
|
40
|
-
break
|
41
|
-
|
42
|
-
except (GRPCError, StreamTerminatedError, ClientClosed) as exc:
|
43
|
-
if retries_remaining > 0:
|
44
|
-
retries_remaining -= 1
|
45
|
-
if isinstance(exc, GRPCError):
|
46
|
-
if exc.status in RETRYABLE_GRPC_STATUS_CODES:
|
47
|
-
await asyncio.sleep(retry_delay)
|
48
|
-
continue
|
49
|
-
elif isinstance(exc, StreamTerminatedError):
|
50
|
-
continue
|
51
|
-
elif isinstance(exc, ClientClosed):
|
52
|
-
break
|
53
|
-
raise
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|