modal 0.68.38__py3-none-any.whl → 0.68.39__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/_utils/deprecation.py +2 -1
- modal/app.py +5 -4
- modal/app.pyi +3 -3
- modal/cli/network_file_system.py +1 -1
- modal/cli/volume.py +1 -1
- modal/client.pyi +2 -2
- modal/cls.py +15 -9
- modal/cls.pyi +5 -5
- modal/dict.py +11 -8
- modal/dict.pyi +8 -8
- modal/environments.py +10 -7
- modal/environments.pyi +6 -6
- modal/functions.py +8 -6
- modal/functions.pyi +11 -11
- modal/mount.py +7 -4
- modal/mount.pyi +4 -4
- modal/network_file_system.py +12 -9
- modal/network_file_system.pyi +8 -8
- modal/queue.py +11 -8
- modal/queue.pyi +8 -8
- modal/secret.py +7 -4
- modal/secret.pyi +5 -5
- modal/volume.py +11 -8
- modal/volume.pyi +8 -8
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/METADATA +1 -1
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/RECORD +31 -31
- modal_version/_version_generated.py +1 -1
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/LICENSE +0 -0
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/WHEEL +0 -0
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/entry_points.txt +0 -0
- {modal-0.68.38.dist-info → modal-0.68.39.dist-info}/top_level.txt +0 -0
modal/mount.pyi
CHANGED
@@ -139,11 +139,11 @@ class _Mount(modal.object._Object):
|
|
139
139
|
ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
|
140
140
|
) -> _Mount: ...
|
141
141
|
@staticmethod
|
142
|
-
def from_name(
|
142
|
+
def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> _Mount: ...
|
143
143
|
@classmethod
|
144
144
|
async def lookup(
|
145
145
|
cls: type[_Mount],
|
146
|
-
|
146
|
+
name: str,
|
147
147
|
namespace=1,
|
148
148
|
client: typing.Optional[modal.client._Client] = None,
|
149
149
|
environment_name: typing.Optional[str] = None,
|
@@ -231,11 +231,11 @@ class Mount(modal.object.Object):
|
|
231
231
|
ignore: typing.Union[typing.Sequence[str], typing.Callable[[pathlib.Path], bool], None] = None,
|
232
232
|
) -> Mount: ...
|
233
233
|
@staticmethod
|
234
|
-
def from_name(
|
234
|
+
def from_name(name: str, namespace=1, environment_name: typing.Optional[str] = None) -> Mount: ...
|
235
235
|
@classmethod
|
236
236
|
def lookup(
|
237
237
|
cls: type[Mount],
|
238
|
-
|
238
|
+
name: str,
|
239
239
|
namespace=1,
|
240
240
|
client: typing.Optional[modal.client.Client] = None,
|
241
241
|
environment_name: typing.Optional[str] = None,
|
modal/network_file_system.py
CHANGED
@@ -15,7 +15,7 @@ from modal_proto import api_pb2
|
|
15
15
|
from ._resolver import Resolver
|
16
16
|
from ._utils.async_utils import TaskContext, aclosing, async_map, sync_or_async_iter, synchronize_api
|
17
17
|
from ._utils.blob_utils import LARGE_FILE_LIMIT, blob_iter, blob_upload_file
|
18
|
-
from ._utils.deprecation import deprecation_error
|
18
|
+
from ._utils.deprecation import deprecation_error, renamed_parameter
|
19
19
|
from ._utils.grpc_utils import retry_transient_errors
|
20
20
|
from ._utils.hash_utils import get_sha256_hex
|
21
21
|
from ._utils.name_utils import check_object_name
|
@@ -101,8 +101,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
101
101
|
deprecation_error((2024, 3, 20), message)
|
102
102
|
|
103
103
|
@staticmethod
|
104
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
104
105
|
def from_name(
|
105
|
-
|
106
|
+
name: str,
|
106
107
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
107
108
|
environment_name: Optional[str] = None,
|
108
109
|
create_if_missing: bool = False,
|
@@ -121,11 +122,11 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
121
122
|
pass
|
122
123
|
```
|
123
124
|
"""
|
124
|
-
check_object_name(
|
125
|
+
check_object_name(name, "NetworkFileSystem")
|
125
126
|
|
126
127
|
async def _load(self: _NetworkFileSystem, resolver: Resolver, existing_object_id: Optional[str]):
|
127
128
|
req = api_pb2.SharedVolumeGetOrCreateRequest(
|
128
|
-
deployment_name=
|
129
|
+
deployment_name=name,
|
129
130
|
namespace=namespace,
|
130
131
|
environment_name=_get_environment_name(environment_name, resolver),
|
131
132
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -136,7 +137,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
136
137
|
except GRPCError as exc:
|
137
138
|
if exc.status == Status.NOT_FOUND and exc.message == "App has wrong entity vo":
|
138
139
|
raise InvalidError(
|
139
|
-
f"Attempted to mount: `{
|
140
|
+
f"Attempted to mount: `{name}` as a NetworkFileSystem " + "which already exists as a Volume"
|
140
141
|
)
|
141
142
|
raise
|
142
143
|
|
@@ -176,8 +177,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
176
177
|
yield cls._new_hydrated(response.shared_volume_id, client, None, is_another_app=True)
|
177
178
|
|
178
179
|
@staticmethod
|
180
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
179
181
|
async def lookup(
|
180
|
-
|
182
|
+
name: str,
|
181
183
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
182
184
|
client: Optional[_Client] = None,
|
183
185
|
environment_name: Optional[str] = None,
|
@@ -194,7 +196,7 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
194
196
|
```
|
195
197
|
"""
|
196
198
|
obj = _NetworkFileSystem.from_name(
|
197
|
-
|
199
|
+
name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
|
198
200
|
)
|
199
201
|
if client is None:
|
200
202
|
client = await _Client.from_env()
|
@@ -223,8 +225,9 @@ class _NetworkFileSystem(_Object, type_prefix="sv"):
|
|
223
225
|
return resp.shared_volume_id
|
224
226
|
|
225
227
|
@staticmethod
|
226
|
-
|
227
|
-
|
228
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
229
|
+
async def delete(name: str, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
230
|
+
obj = await _NetworkFileSystem.lookup(name, client=client, environment_name=environment_name)
|
228
231
|
req = api_pb2.SharedVolumeDeleteRequest(shared_volume_id=obj.object_id)
|
229
232
|
await retry_transient_errors(obj._client.stub.SharedVolumeDelete, req)
|
230
233
|
|
modal/network_file_system.pyi
CHANGED
@@ -17,7 +17,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
17
17
|
def new(cloud: typing.Optional[str] = None): ...
|
18
18
|
@staticmethod
|
19
19
|
def from_name(
|
20
|
-
|
20
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
21
21
|
) -> _NetworkFileSystem: ...
|
22
22
|
@classmethod
|
23
23
|
def ephemeral(
|
@@ -28,7 +28,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
28
28
|
) -> typing.AsyncContextManager[_NetworkFileSystem]: ...
|
29
29
|
@staticmethod
|
30
30
|
async def lookup(
|
31
|
-
|
31
|
+
name: str,
|
32
32
|
namespace=1,
|
33
33
|
client: typing.Optional[modal.client._Client] = None,
|
34
34
|
environment_name: typing.Optional[str] = None,
|
@@ -43,7 +43,7 @@ class _NetworkFileSystem(modal.object._Object):
|
|
43
43
|
) -> str: ...
|
44
44
|
@staticmethod
|
45
45
|
async def delete(
|
46
|
-
|
46
|
+
name: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
|
47
47
|
): ...
|
48
48
|
async def write_file(
|
49
49
|
self,
|
@@ -74,7 +74,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
74
74
|
def new(cloud: typing.Optional[str] = None): ...
|
75
75
|
@staticmethod
|
76
76
|
def from_name(
|
77
|
-
|
77
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
78
78
|
) -> NetworkFileSystem: ...
|
79
79
|
@classmethod
|
80
80
|
def ephemeral(
|
@@ -87,7 +87,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
87
87
|
class __lookup_spec(typing_extensions.Protocol):
|
88
88
|
def __call__(
|
89
89
|
self,
|
90
|
-
|
90
|
+
name: str,
|
91
91
|
namespace=1,
|
92
92
|
client: typing.Optional[modal.client.Client] = None,
|
93
93
|
environment_name: typing.Optional[str] = None,
|
@@ -95,7 +95,7 @@ class NetworkFileSystem(modal.object.Object):
|
|
95
95
|
) -> NetworkFileSystem: ...
|
96
96
|
async def aio(
|
97
97
|
self,
|
98
|
-
|
98
|
+
name: str,
|
99
99
|
namespace=1,
|
100
100
|
client: typing.Optional[modal.client.Client] = None,
|
101
101
|
environment_name: typing.Optional[str] = None,
|
@@ -125,13 +125,13 @@ class NetworkFileSystem(modal.object.Object):
|
|
125
125
|
class __delete_spec(typing_extensions.Protocol):
|
126
126
|
def __call__(
|
127
127
|
self,
|
128
|
-
|
128
|
+
name: str,
|
129
129
|
client: typing.Optional[modal.client.Client] = None,
|
130
130
|
environment_name: typing.Optional[str] = None,
|
131
131
|
): ...
|
132
132
|
async def aio(
|
133
133
|
self,
|
134
|
-
|
134
|
+
name: str,
|
135
135
|
client: typing.Optional[modal.client.Client] = None,
|
136
136
|
environment_name: typing.Optional[str] = None,
|
137
137
|
): ...
|
modal/queue.py
CHANGED
@@ -13,7 +13,7 @@ from modal_proto import api_pb2
|
|
13
13
|
from ._resolver import Resolver
|
14
14
|
from ._serialization import deserialize, serialize
|
15
15
|
from ._utils.async_utils import TaskContext, synchronize_api, warn_if_generator_is_not_consumed
|
16
|
-
from ._utils.deprecation import deprecation_error
|
16
|
+
from ._utils.deprecation import deprecation_error, renamed_parameter
|
17
17
|
from ._utils.grpc_utils import retry_transient_errors
|
18
18
|
from ._utils.name_utils import check_object_name
|
19
19
|
from .client import _Client
|
@@ -154,8 +154,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
154
154
|
yield cls._new_hydrated(response.queue_id, client, None, is_another_app=True)
|
155
155
|
|
156
156
|
@staticmethod
|
157
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
157
158
|
def from_name(
|
158
|
-
|
159
|
+
name: str,
|
159
160
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
160
161
|
environment_name: Optional[str] = None,
|
161
162
|
create_if_missing: bool = False,
|
@@ -171,11 +172,11 @@ class _Queue(_Object, type_prefix="qu"):
|
|
171
172
|
q.put(123)
|
172
173
|
```
|
173
174
|
"""
|
174
|
-
check_object_name(
|
175
|
+
check_object_name(name, "Queue")
|
175
176
|
|
176
177
|
async def _load(self: _Queue, resolver: Resolver, existing_object_id: Optional[str]):
|
177
178
|
req = api_pb2.QueueGetOrCreateRequest(
|
178
|
-
deployment_name=
|
179
|
+
deployment_name=name,
|
179
180
|
namespace=namespace,
|
180
181
|
environment_name=_get_environment_name(environment_name, resolver),
|
181
182
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -186,8 +187,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
186
187
|
return _Queue._from_loader(_load, "Queue()", is_another_app=True, hydrate_lazily=True)
|
187
188
|
|
188
189
|
@staticmethod
|
190
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
189
191
|
async def lookup(
|
190
|
-
|
192
|
+
name: str,
|
191
193
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
192
194
|
client: Optional[_Client] = None,
|
193
195
|
environment_name: Optional[str] = None,
|
@@ -204,7 +206,7 @@ class _Queue(_Object, type_prefix="qu"):
|
|
204
206
|
```
|
205
207
|
"""
|
206
208
|
obj = _Queue.from_name(
|
207
|
-
|
209
|
+
name, namespace=namespace, environment_name=environment_name, create_if_missing=create_if_missing
|
208
210
|
)
|
209
211
|
if client is None:
|
210
212
|
client = await _Client.from_env()
|
@@ -213,8 +215,9 @@ class _Queue(_Object, type_prefix="qu"):
|
|
213
215
|
return obj
|
214
216
|
|
215
217
|
@staticmethod
|
216
|
-
|
217
|
-
|
218
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
219
|
+
async def delete(name: str, *, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
220
|
+
obj = await _Queue.lookup(name, client=client, environment_name=environment_name)
|
218
221
|
req = api_pb2.QueueDeleteRequest(queue_id=obj.object_id)
|
219
222
|
await retry_transient_errors(obj._client.stub.QueueDelete, req)
|
220
223
|
|
modal/queue.pyi
CHANGED
@@ -20,11 +20,11 @@ class _Queue(modal.object._Object):
|
|
20
20
|
) -> typing.AsyncContextManager[_Queue]: ...
|
21
21
|
@staticmethod
|
22
22
|
def from_name(
|
23
|
-
|
23
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
24
24
|
) -> _Queue: ...
|
25
25
|
@staticmethod
|
26
26
|
async def lookup(
|
27
|
-
|
27
|
+
name: str,
|
28
28
|
namespace=1,
|
29
29
|
client: typing.Optional[modal.client._Client] = None,
|
30
30
|
environment_name: typing.Optional[str] = None,
|
@@ -32,7 +32,7 @@ class _Queue(modal.object._Object):
|
|
32
32
|
) -> _Queue: ...
|
33
33
|
@staticmethod
|
34
34
|
async def delete(
|
35
|
-
|
35
|
+
name: str,
|
36
36
|
*,
|
37
37
|
client: typing.Optional[modal.client._Client] = None,
|
38
38
|
environment_name: typing.Optional[str] = None,
|
@@ -101,13 +101,13 @@ class Queue(modal.object.Object):
|
|
101
101
|
) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Queue]: ...
|
102
102
|
@staticmethod
|
103
103
|
def from_name(
|
104
|
-
|
104
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
|
105
105
|
) -> Queue: ...
|
106
106
|
|
107
107
|
class __lookup_spec(typing_extensions.Protocol):
|
108
108
|
def __call__(
|
109
109
|
self,
|
110
|
-
|
110
|
+
name: str,
|
111
111
|
namespace=1,
|
112
112
|
client: typing.Optional[modal.client.Client] = None,
|
113
113
|
environment_name: typing.Optional[str] = None,
|
@@ -115,7 +115,7 @@ class Queue(modal.object.Object):
|
|
115
115
|
) -> Queue: ...
|
116
116
|
async def aio(
|
117
117
|
self,
|
118
|
-
|
118
|
+
name: str,
|
119
119
|
namespace=1,
|
120
120
|
client: typing.Optional[modal.client.Client] = None,
|
121
121
|
environment_name: typing.Optional[str] = None,
|
@@ -127,14 +127,14 @@ class Queue(modal.object.Object):
|
|
127
127
|
class __delete_spec(typing_extensions.Protocol):
|
128
128
|
def __call__(
|
129
129
|
self,
|
130
|
-
|
130
|
+
name: str,
|
131
131
|
*,
|
132
132
|
client: typing.Optional[modal.client.Client] = None,
|
133
133
|
environment_name: typing.Optional[str] = None,
|
134
134
|
): ...
|
135
135
|
async def aio(
|
136
136
|
self,
|
137
|
-
|
137
|
+
name: str,
|
138
138
|
*,
|
139
139
|
client: typing.Optional[modal.client.Client] = None,
|
140
140
|
environment_name: typing.Optional[str] = None,
|
modal/secret.py
CHANGED
@@ -9,6 +9,7 @@ from modal_proto import api_pb2
|
|
9
9
|
from ._resolver import Resolver
|
10
10
|
from ._runtime.execution_context import is_local
|
11
11
|
from ._utils.async_utils import synchronize_api
|
12
|
+
from ._utils.deprecation import renamed_parameter
|
12
13
|
from ._utils.grpc_utils import retry_transient_errors
|
13
14
|
from ._utils.name_utils import check_object_name
|
14
15
|
from .client import _Client
|
@@ -161,8 +162,9 @@ class _Secret(_Object, type_prefix="st"):
|
|
161
162
|
return _Secret._from_loader(_load, "Secret.from_dotenv()", hydrate_lazily=True)
|
162
163
|
|
163
164
|
@staticmethod
|
165
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
164
166
|
def from_name(
|
165
|
-
|
167
|
+
name: str,
|
166
168
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
167
169
|
environment_name: Optional[str] = None,
|
168
170
|
required_keys: list[
|
@@ -186,7 +188,7 @@ class _Secret(_Object, type_prefix="st"):
|
|
186
188
|
|
187
189
|
async def _load(self: _Secret, resolver: Resolver, existing_object_id: Optional[str]):
|
188
190
|
req = api_pb2.SecretGetOrCreateRequest(
|
189
|
-
deployment_name=
|
191
|
+
deployment_name=name,
|
190
192
|
namespace=namespace,
|
191
193
|
environment_name=_get_environment_name(environment_name, resolver),
|
192
194
|
required_keys=required_keys,
|
@@ -203,8 +205,9 @@ class _Secret(_Object, type_prefix="st"):
|
|
203
205
|
return _Secret._from_loader(_load, "Secret()", hydrate_lazily=True)
|
204
206
|
|
205
207
|
@staticmethod
|
208
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
206
209
|
async def lookup(
|
207
|
-
|
210
|
+
name: str,
|
208
211
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
209
212
|
client: Optional[_Client] = None,
|
210
213
|
environment_name: Optional[str] = None,
|
@@ -212,7 +215,7 @@ class _Secret(_Object, type_prefix="st"):
|
|
212
215
|
) -> "_Secret":
|
213
216
|
"""mdmd:hidden"""
|
214
217
|
obj = _Secret.from_name(
|
215
|
-
|
218
|
+
name, namespace=namespace, environment_name=environment_name, required_keys=required_keys
|
216
219
|
)
|
217
220
|
if client is None:
|
218
221
|
client = await _Client.from_env()
|
modal/secret.pyi
CHANGED
@@ -12,11 +12,11 @@ class _Secret(modal.object._Object):
|
|
12
12
|
def from_dotenv(path=None, *, filename=".env"): ...
|
13
13
|
@staticmethod
|
14
14
|
def from_name(
|
15
|
-
|
15
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
16
16
|
) -> _Secret: ...
|
17
17
|
@staticmethod
|
18
18
|
async def lookup(
|
19
|
-
|
19
|
+
name: str,
|
20
20
|
namespace=1,
|
21
21
|
client: typing.Optional[modal.client._Client] = None,
|
22
22
|
environment_name: typing.Optional[str] = None,
|
@@ -42,13 +42,13 @@ class Secret(modal.object.Object):
|
|
42
42
|
def from_dotenv(path=None, *, filename=".env"): ...
|
43
43
|
@staticmethod
|
44
44
|
def from_name(
|
45
|
-
|
45
|
+
name: str, namespace=1, environment_name: typing.Optional[str] = None, required_keys: list[str] = []
|
46
46
|
) -> Secret: ...
|
47
47
|
|
48
48
|
class __lookup_spec(typing_extensions.Protocol):
|
49
49
|
def __call__(
|
50
50
|
self,
|
51
|
-
|
51
|
+
name: str,
|
52
52
|
namespace=1,
|
53
53
|
client: typing.Optional[modal.client.Client] = None,
|
54
54
|
environment_name: typing.Optional[str] = None,
|
@@ -56,7 +56,7 @@ class Secret(modal.object.Object):
|
|
56
56
|
) -> Secret: ...
|
57
57
|
async def aio(
|
58
58
|
self,
|
59
|
-
|
59
|
+
name: str,
|
60
60
|
namespace=1,
|
61
61
|
client: typing.Optional[modal.client.Client] = None,
|
62
62
|
environment_name: typing.Optional[str] = None,
|
modal/volume.py
CHANGED
@@ -36,7 +36,7 @@ from ._utils.blob_utils import (
|
|
36
36
|
get_file_upload_spec_from_fileobj,
|
37
37
|
get_file_upload_spec_from_path,
|
38
38
|
)
|
39
|
-
from ._utils.deprecation import deprecation_error, deprecation_warning
|
39
|
+
from ._utils.deprecation import deprecation_error, deprecation_warning, renamed_parameter
|
40
40
|
from ._utils.grpc_utils import retry_transient_errors
|
41
41
|
from ._utils.name_utils import check_object_name
|
42
42
|
from .client import _Client
|
@@ -144,8 +144,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
144
144
|
deprecation_error((2024, 3, 20), message)
|
145
145
|
|
146
146
|
@staticmethod
|
147
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
147
148
|
def from_name(
|
148
|
-
|
149
|
+
name: str,
|
149
150
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
150
151
|
environment_name: Optional[str] = None,
|
151
152
|
create_if_missing: bool = False,
|
@@ -168,11 +169,11 @@ class _Volume(_Object, type_prefix="vo"):
|
|
168
169
|
pass
|
169
170
|
```
|
170
171
|
"""
|
171
|
-
check_object_name(
|
172
|
+
check_object_name(name, "Volume")
|
172
173
|
|
173
174
|
async def _load(self: _Volume, resolver: Resolver, existing_object_id: Optional[str]):
|
174
175
|
req = api_pb2.VolumeGetOrCreateRequest(
|
175
|
-
deployment_name=
|
176
|
+
deployment_name=name,
|
176
177
|
namespace=namespace,
|
177
178
|
environment_name=_get_environment_name(environment_name, resolver),
|
178
179
|
object_creation_type=(api_pb2.OBJECT_CREATION_TYPE_CREATE_IF_MISSING if create_if_missing else None),
|
@@ -220,8 +221,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
220
221
|
yield cls._new_hydrated(response.volume_id, client, None, is_another_app=True)
|
221
222
|
|
222
223
|
@staticmethod
|
224
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
223
225
|
async def lookup(
|
224
|
-
|
226
|
+
name: str,
|
225
227
|
namespace=api_pb2.DEPLOYMENT_NAMESPACE_WORKSPACE,
|
226
228
|
client: Optional[_Client] = None,
|
227
229
|
environment_name: Optional[str] = None,
|
@@ -239,7 +241,7 @@ class _Volume(_Object, type_prefix="vo"):
|
|
239
241
|
```
|
240
242
|
"""
|
241
243
|
obj = _Volume.from_name(
|
242
|
-
|
244
|
+
name,
|
243
245
|
namespace=namespace,
|
244
246
|
environment_name=environment_name,
|
245
247
|
create_if_missing=create_if_missing,
|
@@ -507,8 +509,9 @@ class _Volume(_Object, type_prefix="vo"):
|
|
507
509
|
)
|
508
510
|
|
509
511
|
@staticmethod
|
510
|
-
|
511
|
-
|
512
|
+
@renamed_parameter((2024, 12, 18), "label", "name")
|
513
|
+
async def delete(name: str, client: Optional[_Client] = None, environment_name: Optional[str] = None):
|
514
|
+
obj = await _Volume.lookup(name, client=client, environment_name=environment_name)
|
512
515
|
req = api_pb2.VolumeDeleteRequest(volume_id=obj.object_id)
|
513
516
|
await retry_transient_errors(obj._client.stub.VolumeDelete, req)
|
514
517
|
|
modal/volume.pyi
CHANGED
@@ -41,7 +41,7 @@ class _Volume(modal.object._Object):
|
|
41
41
|
def new(): ...
|
42
42
|
@staticmethod
|
43
43
|
def from_name(
|
44
|
-
|
44
|
+
name: str,
|
45
45
|
namespace=1,
|
46
46
|
environment_name: typing.Optional[str] = None,
|
47
47
|
create_if_missing: bool = False,
|
@@ -57,7 +57,7 @@ class _Volume(modal.object._Object):
|
|
57
57
|
) -> typing.AsyncContextManager[_Volume]: ...
|
58
58
|
@staticmethod
|
59
59
|
async def lookup(
|
60
|
-
|
60
|
+
name: str,
|
61
61
|
namespace=1,
|
62
62
|
client: typing.Optional[modal.client._Client] = None,
|
63
63
|
environment_name: typing.Optional[str] = None,
|
@@ -85,7 +85,7 @@ class _Volume(modal.object._Object):
|
|
85
85
|
async def _instance_delete(self): ...
|
86
86
|
@staticmethod
|
87
87
|
async def delete(
|
88
|
-
|
88
|
+
name: str, client: typing.Optional[modal.client._Client] = None, environment_name: typing.Optional[str] = None
|
89
89
|
): ...
|
90
90
|
|
91
91
|
class _VolumeUploadContextManager:
|
@@ -137,7 +137,7 @@ class Volume(modal.object.Object):
|
|
137
137
|
def new(): ...
|
138
138
|
@staticmethod
|
139
139
|
def from_name(
|
140
|
-
|
140
|
+
name: str,
|
141
141
|
namespace=1,
|
142
142
|
environment_name: typing.Optional[str] = None,
|
143
143
|
create_if_missing: bool = False,
|
@@ -155,7 +155,7 @@ class Volume(modal.object.Object):
|
|
155
155
|
class __lookup_spec(typing_extensions.Protocol):
|
156
156
|
def __call__(
|
157
157
|
self,
|
158
|
-
|
158
|
+
name: str,
|
159
159
|
namespace=1,
|
160
160
|
client: typing.Optional[modal.client.Client] = None,
|
161
161
|
environment_name: typing.Optional[str] = None,
|
@@ -164,7 +164,7 @@ class Volume(modal.object.Object):
|
|
164
164
|
) -> Volume: ...
|
165
165
|
async def aio(
|
166
166
|
self,
|
167
|
-
|
167
|
+
name: str,
|
168
168
|
namespace=1,
|
169
169
|
client: typing.Optional[modal.client.Client] = None,
|
170
170
|
environment_name: typing.Optional[str] = None,
|
@@ -263,13 +263,13 @@ class Volume(modal.object.Object):
|
|
263
263
|
class __delete_spec(typing_extensions.Protocol):
|
264
264
|
def __call__(
|
265
265
|
self,
|
266
|
-
|
266
|
+
name: str,
|
267
267
|
client: typing.Optional[modal.client.Client] = None,
|
268
268
|
environment_name: typing.Optional[str] = None,
|
269
269
|
): ...
|
270
270
|
async def aio(
|
271
271
|
self,
|
272
|
-
|
272
|
+
name: str,
|
273
273
|
client: typing.Optional[modal.client.Client] = None,
|
274
274
|
environment_name: typing.Optional[str] = None,
|
275
275
|
): ...
|