modal 1.1.1.dev7__py3-none-any.whl → 1.1.1.dev10__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/client.pyi CHANGED
@@ -33,7 +33,7 @@ class _Client:
33
33
  server_url: str,
34
34
  client_type: int,
35
35
  credentials: typing.Optional[tuple[str, str]],
36
- version: str = "1.1.1.dev7",
36
+ version: str = "1.1.1.dev10",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -163,7 +163,7 @@ class Client:
163
163
  server_url: str,
164
164
  client_type: int,
165
165
  credentials: typing.Optional[tuple[str, str]],
166
- version: str = "1.1.1.dev7",
166
+ version: str = "1.1.1.dev10",
167
167
  ):
168
168
  """mdmd:hidden
169
169
  The Modal client object is not intended to be instantiated directly by users.
modal/exception.py CHANGED
@@ -26,6 +26,10 @@ class Error(Exception):
26
26
  """
27
27
 
28
28
 
29
+ class AlreadyExistsError(Error):
30
+ """Raised when a resource creation conflicts with an existing resource."""
31
+
32
+
29
33
  class RemoteError(Error):
30
34
  """Raised when an error occurs on the Modal server."""
31
35
 
@@ -20,7 +20,7 @@ from ..cls import _Cls, _Obj
20
20
  from ..exception import InvalidError
21
21
  from ..image import DockerfileSpec, ImageBuilderVersion, _Image, _ImageRegistryConfig
22
22
  from ..secret import _Secret
23
- from .flash import flash_forward, flash_prometheus_autoscaler # noqa: F401
23
+ from .flash import flash_forward, flash_get_containers, flash_prometheus_autoscaler # noqa: F401
24
24
 
25
25
 
26
26
  def stop_fetching_inputs():
@@ -447,3 +447,20 @@ async def flash_prometheus_autoscaler(
447
447
  )
448
448
  await autoscaler.start()
449
449
  return autoscaler
450
+
451
+
452
+ @synchronizer.create_blocking
453
+ async def flash_get_containers(app_name: str, cls_name: str) -> list[dict[str, Any]]:
454
+ """
455
+ Return a list of flash containers for a deployed Flash service.
456
+
457
+ This is a highly experimental method that can break or be removed at any time without warning.
458
+ Do not use this method unless explicitly instructed to do so by Modal support.
459
+ """
460
+ client = await _Client.from_env()
461
+ fn = _Cls.from_name(app_name, cls_name)._class_service_function
462
+ assert fn is not None
463
+ await fn.hydrate(client=client)
464
+ req = api_pb2.FlashContainerListRequest(function_id=fn.object_id)
465
+ resp = await retry_transient_errors(client.stub.FlashContainerList, req)
466
+ return resp.containers
@@ -250,3 +250,22 @@ class __flash_prometheus_autoscaler_spec(typing_extensions.Protocol):
250
250
  ...
251
251
 
252
252
  flash_prometheus_autoscaler: __flash_prometheus_autoscaler_spec
253
+
254
+ class __flash_get_containers_spec(typing_extensions.Protocol):
255
+ def __call__(self, /, app_name: str, cls_name: str) -> list[dict[str, typing.Any]]:
256
+ """Return a list of flash containers for a deployed Flash service.
257
+
258
+ This is a highly experimental method that can break or be removed at any time without warning.
259
+ Do not use this method unless explicitly instructed to do so by Modal support.
260
+ """
261
+ ...
262
+
263
+ async def aio(self, /, app_name: str, cls_name: str) -> list[dict[str, typing.Any]]:
264
+ """Return a list of flash containers for a deployed Flash service.
265
+
266
+ This is a highly experimental method that can break or be removed at any time without warning.
267
+ Do not use this method unless explicitly instructed to do so by Modal support.
268
+ """
269
+ ...
270
+
271
+ flash_get_containers: __flash_get_containers_spec
modal/sandbox.py CHANGED
@@ -27,7 +27,7 @@ from ._utils.mount_utils import validate_network_file_systems, validate_volumes
27
27
  from .client import _Client
28
28
  from .config import config
29
29
  from .container_process import _ContainerProcess
30
- from .exception import ExecutionError, InvalidError, SandboxTerminatedError, SandboxTimeoutError
30
+ from .exception import AlreadyExistsError, ExecutionError, InvalidError, SandboxTerminatedError, SandboxTimeoutError
31
31
  from .file_io import FileWatchEvent, FileWatchEventType, _FileIO
32
32
  from .gpu import GPU_T
33
33
  from .image import _Image
@@ -236,7 +236,12 @@ class _Sandbox(_Object, type_prefix="sb"):
236
236
  )
237
237
 
238
238
  create_req = api_pb2.SandboxCreateRequest(app_id=resolver.app_id, definition=definition)
239
- create_resp = await retry_transient_errors(resolver.client.stub.SandboxCreate, create_req)
239
+ try:
240
+ create_resp = await retry_transient_errors(resolver.client.stub.SandboxCreate, create_req)
241
+ except GRPCError as exc:
242
+ if exc.status == Status.ALREADY_EXISTS:
243
+ raise AlreadyExistsError(exc.message)
244
+ raise exc
240
245
 
241
246
  sandbox_id = create_resp.sandbox_id
242
247
  self._hydrate(sandbox_id, resolver.client, None)
@@ -475,8 +480,8 @@ class _Sandbox(_Object, type_prefix="sb"):
475
480
  ) -> "_Sandbox":
476
481
  """Get a running Sandbox by name from the given app.
477
482
 
478
- Raises an error if no running sandbox is found with the given name. A Sandbox's name
479
- is the `name` argument passed to `Sandbox.create`.
483
+ Raises a modal.exception.NotFoundError if no running sandbox is found with the given name.
484
+ A Sandbox's name is the `name` argument passed to `Sandbox.create`.
480
485
  """
481
486
  if client is None:
482
487
  client = await _Client.from_env()
@@ -786,10 +791,15 @@ class _Sandbox(_Object, type_prefix="sb"):
786
791
  sandbox_name_override=name,
787
792
  sandbox_name_override_type=api_pb2.SandboxRestoreRequest.SANDBOX_NAME_OVERRIDE_TYPE_STRING,
788
793
  )
794
+ try:
795
+ restore_resp: api_pb2.SandboxRestoreResponse = await retry_transient_errors(
796
+ client.stub.SandboxRestore, restore_req
797
+ )
798
+ except GRPCError as exc:
799
+ if exc.status == Status.ALREADY_EXISTS:
800
+ raise AlreadyExistsError(exc.message)
801
+ raise exc
789
802
 
790
- restore_resp: api_pb2.SandboxRestoreResponse = await retry_transient_errors(
791
- client.stub.SandboxRestore, restore_req
792
- )
793
803
  sandbox = await _Sandbox.from_id(restore_resp.sandbox_id, client)
794
804
 
795
805
  task_id_req = api_pb2.SandboxGetTaskIdRequest(
modal/sandbox.pyi CHANGED
@@ -178,8 +178,8 @@ class _Sandbox(modal._object._Object):
178
178
  ) -> _Sandbox:
179
179
  """Get a running Sandbox by name from the given app.
180
180
 
181
- Raises an error if no running sandbox is found with the given name. A Sandbox's name
182
- is the `name` argument passed to `Sandbox.create`.
181
+ Raises a modal.exception.NotFoundError if no running sandbox is found with the given name.
182
+ A Sandbox's name is the `name` argument passed to `Sandbox.create`.
183
183
  """
184
184
  ...
185
185
 
@@ -588,8 +588,8 @@ class Sandbox(modal.object.Object):
588
588
  ) -> Sandbox:
589
589
  """Get a running Sandbox by name from the given app.
590
590
 
591
- Raises an error if no running sandbox is found with the given name. A Sandbox's name
592
- is the `name` argument passed to `Sandbox.create`.
591
+ Raises a modal.exception.NotFoundError if no running sandbox is found with the given name.
592
+ A Sandbox's name is the `name` argument passed to `Sandbox.create`.
593
593
  """
594
594
  ...
595
595
 
@@ -604,8 +604,8 @@ class Sandbox(modal.object.Object):
604
604
  ) -> Sandbox:
605
605
  """Get a running Sandbox by name from the given app.
606
606
 
607
- Raises an error if no running sandbox is found with the given name. A Sandbox's name
608
- is the `name` argument passed to `Sandbox.create`.
607
+ Raises a modal.exception.NotFoundError if no running sandbox is found with the given name.
608
+ A Sandbox's name is the `name` argument passed to `Sandbox.create`.
609
609
  """
610
610
  ...
611
611
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.1.1.dev7
3
+ Version: 1.1.1.dev10
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -22,7 +22,7 @@ modal/app.py,sha256=BBR2NmGzZbFGfhKAmtzllD0o4TbVDBbOEs0O2ysSdQo,48277
22
22
  modal/app.pyi,sha256=h6JtBA6a7wobdZAuS3QuXrWCUZqfyKPuGV3XdjCqT3k,43753
23
23
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
24
24
  modal/client.py,sha256=pBSZ7lv5dezIL9U9H4tpE0Yz6qA1n0NoNbnJ3KCQMMA,18252
25
- modal/client.pyi,sha256=odxqEiQojtyZ4FEUS7bywyqAGN_8h_fKdqzEzqUe_pY,15388
25
+ modal/client.pyi,sha256=KeyQ4EBjOjjQ4595mxR2Dyl-5bXuS9t-ixUEm4ehhzc,15390
26
26
  modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
27
27
  modal/cloud_bucket_mount.pyi,sha256=-qSfYAQvIoO_l2wsCCGTG5ZUwQieNKXdAO00yP1-LYU,7394
28
28
  modal/cls.py,sha256=7A0xGnugQzm8dOfnKMjLjtqekRlRtQ0jPFRYgq6xdUM,40018
@@ -34,7 +34,7 @@ modal/dict.py,sha256=wVIkHPFvR8WDoh5c6jT0UstZYmJTpCTM8drkwwjLiAc,14387
34
34
  modal/dict.pyi,sha256=gs3J7X5yG3J1L6rW0s3_7yRn8qAfY0f4n5-sqaDZY2g,20853
35
35
  modal/environments.py,sha256=gHFNLG78bqgizpQ4w_elz27QOqmcgAonFsmLs7NjUJ4,6804
36
36
  modal/environments.pyi,sha256=9-KtrzAcUe55cCP4020lSUD7-fWS7OPakAHssq4-bro,4219
37
- modal/exception.py,sha256=RjfKTJH7-Gcf_33BGkvDch-ry1Zx9u6-0QLViNxNTaU,5520
37
+ modal/exception.py,sha256=o0V93PK8Hcg2YQ2aeOB1Y-qWBw4Gz5ATfyokR8GapuQ,5634
38
38
  modal/file_io.py,sha256=BVqAJ0sgPUfN8QsYztWiGB4j56he60TncM02KsylnCw,21449
39
39
  modal/file_io.pyi,sha256=cPT_hsplE5iLCXhYOLn1Sp9eDdk7DxdFmicQHanJZyg,15918
40
40
  modal/file_pattern_matcher.py,sha256=urAue8es8jxqX94k9EYoZxxhtfgOlsEES8lbFHOorzc,7734
@@ -65,8 +65,8 @@ modal/retries.py,sha256=IvNLDM0f_GLUDD5VgEDoN09C88yoxSrCquinAuxT1Sc,5205
65
65
  modal/runner.py,sha256=ostdzYpQb-20tlD6dIq7bpWTkZkOhjJBNuMNektqnJA,24068
66
66
  modal/runner.pyi,sha256=lbwLljm1cC8d6PcNvmYQhkE8501V9fg0bYqqKX6G4r4,8489
67
67
  modal/running_app.py,sha256=v61mapYNV1-O-Uaho5EfJlryMLvIT9We0amUOSvSGx8,1188
68
- modal/sandbox.py,sha256=o7LnaMDgfflE6gOvlCESoboFY6_BFZzBydoOhq91t3U,40469
69
- modal/sandbox.pyi,sha256=SRCbHXMBpBT5PBvKuC2lOTv8YenQHk0lvRj8dAqV_X8,41743
68
+ modal/sandbox.py,sha256=_hAoBwParMzooNUo02LRt-nC5RrTGUtOutyO9oI79Kc,40896
69
+ modal/sandbox.pyi,sha256=GPPlsm-DiSUSgrxyA5bqkpuLlrfgmNR7Z7s3W0QLuQ0,41812
70
70
  modal/schedule.py,sha256=ng0g0AqNY5GQI9KhkXZQ5Wam5G42glbkqVQsNpBtbDE,3078
71
71
  modal/scheduler_placement.py,sha256=BAREdOY5HzHpzSBqt6jDVR6YC_jYfHMVqOzkyqQfngU,1235
72
72
  modal/secret.py,sha256=bpgtv0urwaBOmmJpMTZIwVWUraQlpeu4hW8pbJiGcOA,10546
@@ -139,9 +139,9 @@ modal/cli/volume.py,sha256=KJ4WKQYjRGsTERkwHE1HcRia9rWzLIDDnlc89QmTLvE,10960
139
139
  modal/cli/programs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
140
140
  modal/cli/programs/run_jupyter.py,sha256=44Lpvqk2l3hH-uOkmAOzw60NEsfB5uaRDWDKVshvQhs,2682
141
141
  modal/cli/programs/vscode.py,sha256=KbTAaIXyQBVCDXxXjmBHmKpgXkUw0q4R4KkJvUjCYgk,3380
142
- modal/experimental/__init__.py,sha256=XhRr0QQds4fEAoILQFa0CQWUtQ76Gxioo88CupOxDvI,10847
143
- modal/experimental/flash.py,sha256=xqfJLpdqaa7mgW8OgAFBfZV95PKzuTzevh7SOSVesnA,19055
144
- modal/experimental/flash.pyi,sha256=1Nd31nYD8Eqi0BI63XuK6owXPGA0s9CgU_WOAzCQSQs,9957
142
+ modal/experimental/__init__.py,sha256=nuc7AL4r_Fs08DD5dciWFZhrV1nanwoClOfdTcudU0M,10869
143
+ modal/experimental/flash.py,sha256=jPvh-acBgpV-iwsGSNE_kdVdcRgGi7qkfBvrVXd8jhw,19782
144
+ modal/experimental/flash.pyi,sha256=A8_qJGtGoXEzKDdHbvhmCw7oqfneFEvJQK3ZdTOvUdU,10830
145
145
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
146
146
  modal/requirements/2023.12.312.txt,sha256=zWWUVgVQ92GXBKNYYr2-5vn9rlnXcmkqlwlX5u1eTYw,400
147
147
  modal/requirements/2023.12.txt,sha256=OjsbXFkCSdkzzryZP82Q73osr5wxQ6EUzmGcK7twfkA,502
@@ -151,7 +151,7 @@ modal/requirements/2025.06.txt,sha256=KxDaVTOwatHvboDo4lorlgJ7-n-MfAwbPwxJ0zcJqr
151
151
  modal/requirements/PREVIEW.txt,sha256=KxDaVTOwatHvboDo4lorlgJ7-n-MfAwbPwxJ0zcJqrs,312
152
152
  modal/requirements/README.md,sha256=9tK76KP0Uph7O0M5oUgsSwEZDj5y-dcUPsnpR0Sc-Ik,854
153
153
  modal/requirements/base-images.json,sha256=JYSDAgHTl-WrV_TZW5icY-IJEnbe2eQ4CZ_KN6EOZKU,1304
154
- modal-1.1.1.dev7.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
154
+ modal-1.1.1.dev10.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
155
155
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
156
156
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
157
157
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -174,10 +174,10 @@ modal_proto/options_pb2.pyi,sha256=l7DBrbLO7q3Ir-XDkWsajm0d0TQqqrfuX54i4BMpdQg,1
174
174
  modal_proto/options_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
175
175
  modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0yJSI,247
176
176
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
177
- modal_version/__init__.py,sha256=Uj61j1bWCh6nJnoPNXD7pvP73ExmXvI0DzbFcWk9E5U,120
177
+ modal_version/__init__.py,sha256=wk5StIObPUEFCVGa0FZBHdGZnxjFWjlqHz9S27c_78E,121
178
178
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
179
- modal-1.1.1.dev7.dist-info/METADATA,sha256=32k8Jxpgy7uFr7VT5LCzaQhZkvq2Al3iGFnFIpr3USY,2461
180
- modal-1.1.1.dev7.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
181
- modal-1.1.1.dev7.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
182
- modal-1.1.1.dev7.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
183
- modal-1.1.1.dev7.dist-info/RECORD,,
179
+ modal-1.1.1.dev10.dist-info/METADATA,sha256=gDLnUpMx_CBQh3JaAy2F4sO0fRrqFxaZaRjHY9CcKoM,2462
180
+ modal-1.1.1.dev10.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
181
+ modal-1.1.1.dev10.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
182
+ modal-1.1.1.dev10.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
183
+ modal-1.1.1.dev10.dist-info/RECORD,,
modal_version/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
  """Supplies the current version of the modal client library."""
3
3
 
4
- __version__ = "1.1.1.dev7"
4
+ __version__ = "1.1.1.dev10"