modal 1.1.5.dev40__py3-none-any.whl → 1.1.5.dev42__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/_functions.py CHANGED
@@ -477,34 +477,34 @@ class _InputPlaneInvocation:
477
477
  metadata=metadata,
478
478
  )
479
479
 
480
- if await_response.HasField("output"):
481
- if await_response.output.result.status in TERMINAL_STATUSES:
482
- return await _process_result(
483
- await_response.output.result, await_response.output.data_format, self.client.stub, self.client
484
- )
485
-
486
- if await_response.output.result.status == api_pb2.GenericResult.GENERIC_STATUS_INTERNAL_FAILURE:
487
- internal_failure_count += 1
488
- # Limit the number of times we retry
489
- if internal_failure_count < MAX_INTERNAL_FAILURE_COUNT:
490
- # For system failures on the server, we retry immediately,
491
- # and the failure does not count towards the retry policy.
492
- self.attempt_token = await self._retry_input(metadata)
493
- continue
480
+ # Keep awaiting until we get an output.
481
+ if not await_response.HasField("output"):
482
+ continue
483
+
484
+ # If we have a final output, return.
485
+ if await_response.output.result.status in TERMINAL_STATUSES:
486
+ return await _process_result(
487
+ await_response.output.result, await_response.output.data_format, self.client.stub, self.client
488
+ )
494
489
 
495
- # We add delays between retries for non-internal failures.
496
- delay_ms = user_retry_manager.get_delay_ms()
497
- if delay_ms is None:
498
- # No more retries either because we reached the retry limit or user didn't set a retry policy
499
- # and the limit defaulted to 0.
500
- # An unsuccessful status should raise an error when it's converted to an exception.
501
- # Note: Blob download is done on the control plane stub not the input plane stub!
502
- return await _process_result(
503
- await_response.output.result, await_response.output.data_format, self.client.stub, self.client
504
- )
490
+ # We have a failure (internal or application), so see if there are any retries left, and if so, retry.
491
+ if await_response.output.result.status == api_pb2.GenericResult.GENERIC_STATUS_INTERNAL_FAILURE:
492
+ internal_failure_count += 1
493
+ # Limit the number of times we retry internal failures.
494
+ if internal_failure_count < MAX_INTERNAL_FAILURE_COUNT:
495
+ # We immediately retry internal failures and the failure doesn't count towards the retry policy.
496
+ self.attempt_token = await self._retry_input(metadata)
497
+ continue
498
+ elif (delay_ms := user_retry_manager.get_delay_ms()) is not None:
499
+ # We still have user retries left, so sleep and retry.
505
500
  await asyncio.sleep(delay_ms / 1000)
501
+ self.attempt_token = await self._retry_input(metadata)
502
+ continue
506
503
 
507
- await self._retry_input(metadata)
504
+ # No more retries left.
505
+ return await _process_result(
506
+ await_response.output.result, await_response.output.data_format, self.client.stub, self.client
507
+ )
508
508
 
509
509
  async def _retry_input(self, metadata: list[tuple[str, str]]) -> str:
510
510
  retry_request = api_pb2.AttemptRetryRequest(
@@ -513,7 +513,6 @@ class _InputPlaneInvocation:
513
513
  input=self.input_item,
514
514
  attempt_token=self.attempt_token,
515
515
  )
516
- # TODO(ryan): Add exponential backoff?
517
516
  retry_response = await retry_transient_errors(
518
517
  self.stub.AttemptRetry,
519
518
  retry_request,
@@ -1048,7 +1048,8 @@ class _ContainerIOManager:
1048
1048
 
1049
1049
  @classmethod
1050
1050
  def stop_fetching_inputs(cls):
1051
- assert cls._singleton
1051
+ if not cls._singleton:
1052
+ raise RuntimeError("Must be called from within a Modal container.")
1052
1053
  cls._singleton._fetching_inputs = False
1053
1054
 
1054
1055
 
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.5.dev40",
36
+ version: str = "1.1.5.dev42",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -164,7 +164,7 @@ class Client:
164
164
  server_url: str,
165
165
  client_type: int,
166
166
  credentials: typing.Optional[tuple[str, str]],
167
- version: str = "1.1.5.dev40",
167
+ version: str = "1.1.5.dev42",
168
168
  ):
169
169
  """mdmd:hidden
170
170
  The Modal client object is not intended to be instantiated directly by users.
modal/functions.pyi CHANGED
@@ -449,7 +449,7 @@ class Function(
449
449
 
450
450
  _call_generator: ___call_generator_spec[typing_extensions.Self]
451
451
 
452
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
452
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
453
453
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
454
454
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
455
455
  ...
@@ -458,7 +458,7 @@ class Function(
458
458
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
459
459
  ...
460
460
 
461
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
461
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
462
462
 
463
463
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
464
464
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -485,7 +485,7 @@ class Function(
485
485
  """
486
486
  ...
487
487
 
488
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
488
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
489
489
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
490
490
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
491
491
 
@@ -509,7 +509,7 @@ class Function(
509
509
  ...
510
510
 
511
511
  _experimental_spawn: ___experimental_spawn_spec[
512
- modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
512
+ modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
513
513
  ]
514
514
 
515
515
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -518,7 +518,7 @@ class Function(
518
518
 
519
519
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
520
520
 
521
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
521
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
522
522
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
523
523
  """Calls the function with the given arguments, without waiting for the results.
524
524
 
@@ -539,7 +539,7 @@ class Function(
539
539
  """
540
540
  ...
541
541
 
542
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
542
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
543
543
 
544
544
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
545
545
  """Return the inner Python object wrapped by this Modal Function."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.1.5.dev40
3
+ Version: 1.1.5.dev42
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -3,7 +3,7 @@ modal/__main__.py,sha256=45H-GtwzaDfN-1nP4_HYvzN3s7AG_HXR4-ynrsjO_OI,2803
3
3
  modal/_clustered_functions.py,sha256=Sy4Sf_17EO8OL-FUe8LYcm4hrqLyQFCssNhr3p0SroU,3013
4
4
  modal/_clustered_functions.pyi,sha256=JmYwAGOLEnD5AF-gYF9O5tu-SgGjeoJz-X1j48b1Ijg,1157
5
5
  modal/_container_entrypoint.py,sha256=fLluT_sU34vGPCTG1Q58VI1RvxF5n7vQzCVCsL-MMk8,29033
6
- modal/_functions.py,sha256=-T41_HZxzKe6RdwxZAuZFHGuq3VZ5Nl3h1VgMY8AbKM,91605
6
+ modal/_functions.py,sha256=e2HUGJ9Cd1rZnbyzL3DpsAsb_Lnwzs2ud_Khyh-nseE,91399
7
7
  modal/_ipython.py,sha256=TW1fkVOmZL3YYqdS2YlM1hqpf654Yf8ZyybHdBnlhSw,301
8
8
  modal/_location.py,sha256=joiX-0ZeutEUDTrrqLF1GHXCdVLF-rHzstocbMcd_-k,366
9
9
  modal/_object.py,sha256=gwsLdXb-Ecd8nH8LVCo8oVZPzzdyo9BrN1DjgQmsSuM,11967
@@ -22,7 +22,7 @@ modal/app.py,sha256=OBFaL-8KVMtBMEmspHA76LvblPdnSgdoGioLkQBjhdQ,48851
22
22
  modal/app.pyi,sha256=Cqk3pOeEEroCLejj3yJ3XHDqt0rMzeSA295gMKEx6Ww,43955
23
23
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
24
24
  modal/client.py,sha256=kyAIVB3Ay-XKJizQ_1ufUFB__EagV0MLmHJpyYyJ7J0,18636
25
- modal/client.pyi,sha256=WkNFhRKr5XwEDR_2I-Ey8YzV8f8VttdjukjV2c3llkk,15831
25
+ modal/client.pyi,sha256=39cmhpwUmOVGN01zCHGxDfdK5en73S6A5nfJOghENKQ,15831
26
26
  modal/cloud_bucket_mount.py,sha256=I2GRXYhOWLIz2kJZjXu75jAm9EJkBNcutGc6jR2ReUw,5928
27
27
  modal/cloud_bucket_mount.pyi,sha256=VuUOipMIHqFXMkD-3g2bsoqpSxV5qswlFHDOqPQzYAo,7405
28
28
  modal/cls.py,sha256=R1uLQbdqWRRjvxs0I57a4hZZELZkBVCxOKxvKryU5_s,41639
@@ -39,7 +39,7 @@ modal/file_io.py,sha256=OSKr77TujcXGJW1iikzYiHckLSmv07QBgBHcxxYEkoI,21456
39
39
  modal/file_io.pyi,sha256=xtO6Glf_BFwDE7QiQQo24QqcMf_Vv-iz7WojcGVlLBU,15932
40
40
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
41
41
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
42
- modal/functions.pyi,sha256=_xKitEUTNQStdZVtYBgWidtyHHsnjXUYgbirM0eMDyM,39558
42
+ modal/functions.pyi,sha256=AKLl2WxKWcC3vDfhCJ2sbkj-JUMWnRkOcNywjy_wsHs,39558
43
43
  modal/gpu.py,sha256=Fe5ORvVPDIstSq1xjmM6OoNgLYFWvogP9r5BgmD3hYg,6769
44
44
  modal/image.py,sha256=ioYIpKq4Fi1ojqdIyochyoRU1_Ncto_BSYLKzY88zuw,107883
45
45
  modal/image.pyi,sha256=ZNp48mVPzcQ6XNvxin1iO5XrZ89vfEZvU1Bi-V57jq0,76835
@@ -82,7 +82,7 @@ modal/volume.py,sha256=bPC8632-LyeLOjJu2fKOFyod0QG7Hd5bb-UIJ5syCjo,53303
82
82
  modal/volume.pyi,sha256=5VppIgoqoJqpivESYt5_oWgVTL__zlmpNZkOPk43JF8,54443
83
83
  modal/_runtime/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
84
84
  modal/_runtime/asgi.py,sha256=AOcduIlijmlxhXVWo7AIUhigo-bqm6nDkHj4Q4JLy6o,22607
85
- modal/_runtime/container_io_manager.py,sha256=iiFxPfnJjnZd_l2Aj5TCR_O1dQwBcrvHccq0LSIJGZY,45719
85
+ modal/_runtime/container_io_manager.py,sha256=thGJADZe7KW_2XlOn4oG7pBb8wQ3eKs1iATA_2U7jvU,45800
86
86
  modal/_runtime/container_io_manager.pyi,sha256=pcGX7wUdidc2IO3eWOnsEgl9N8e8HG3yFIItXL6JgJI,23626
87
87
  modal/_runtime/execution_context.py,sha256=AYrNQRHHXEqX2MwMf8zxelKZnYf25RE_B-NRLWf93n8,3521
88
88
  modal/_runtime/execution_context.pyi,sha256=FVzakehz72ndL-ufe8-EC7TM4IHO_MEBcAdgWuU4W9k,2426
@@ -153,7 +153,7 @@ modal/experimental/__init__.py,sha256=fCqzo_f3vcY750vHtd7CtLs5dvdM_C0ZLLGb3zXuK9
153
153
  modal/experimental/flash.py,sha256=7qRAL2Nrwbb60YKobcnpM0zJ8vw4xGJqabLPFgEzMZE,28295
154
154
  modal/experimental/flash.pyi,sha256=R9VV0UDotiY9BRUjacB-xI4qhR3yBymAvEZFRFHztLs,15143
155
155
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
156
- modal-1.1.5.dev40.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
156
+ modal-1.1.5.dev42.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
157
157
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
158
158
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
159
159
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -182,10 +182,10 @@ modal_proto/sandbox_router_pb2.py,sha256=INd9izYaIYqllESQt4MSv2Rj9Hf5bMjAvtCc9b4
182
182
  modal_proto/sandbox_router_pb2.pyi,sha256=YCK0WnCgRos3-p7t4USQQ7x6WAuM278yeQX2IeU5mLg,13295
183
183
  modal_proto/sandbox_router_pb2_grpc.py,sha256=zonC5flvCwxeZYJPENj1IJo2Mr0J58DpoC1_8IdPYik,8243
184
184
  modal_proto/sandbox_router_pb2_grpc.pyi,sha256=4QgCB9b7_ykvH8YD-hfnogVH9CLyHVDC5QNb03l4_X8,2735
185
- modal_version/__init__.py,sha256=4ngJ16hLem_-jii46OdwzaZTp0Wb_KurnPYHHqEVYUQ,121
185
+ modal_version/__init__.py,sha256=BhJdbUsmaoeKV67guSRvj5adjySgJaG-LlmK_WqthzE,121
186
186
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
187
- modal-1.1.5.dev40.dist-info/METADATA,sha256=0a_GtU51G67CeM958nKI45T4FP05K1-ZoP4EHVEo8lM,2460
188
- modal-1.1.5.dev40.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
189
- modal-1.1.5.dev40.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
190
- modal-1.1.5.dev40.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
191
- modal-1.1.5.dev40.dist-info/RECORD,,
187
+ modal-1.1.5.dev42.dist-info/METADATA,sha256=paqr2OYGqOkI5rdLaXLkTWfqQXavMWJQOqEtyBZQeaQ,2460
188
+ modal-1.1.5.dev42.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
189
+ modal-1.1.5.dev42.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
190
+ modal-1.1.5.dev42.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
191
+ modal-1.1.5.dev42.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.5.dev40"
4
+ __version__ = "1.1.5.dev42"