modal 0.74.18__py3-none-any.whl → 0.74.20__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/_functions.py CHANGED
@@ -970,7 +970,20 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
970
970
  parent = self
971
971
 
972
972
  async def _load(param_bound_func: _Function, resolver: Resolver, existing_object_id: Optional[str]):
973
- await parent.hydrate()
973
+ try:
974
+ identity = f"{parent.info.function_name} class service function"
975
+ except Exception:
976
+ # Can't always look up the function name that way, so fall back to generic message
977
+ identity = "class service function for a parametrized class"
978
+ if not parent.is_hydrated:
979
+ if parent.app._running_app is None:
980
+ reason = ", because the App it is defined on is not running"
981
+ else:
982
+ reason = ""
983
+ raise ExecutionError(
984
+ f"The {identity} has not been hydrated with the metadata it needs to run on Modal{reason}."
985
+ )
986
+
974
987
  assert parent._client and parent._client.stub
975
988
 
976
989
  if (
@@ -352,15 +352,19 @@ class _ContainerIOManager:
352
352
  await self._client.stub.ContainerHello(Empty())
353
353
 
354
354
  async def _run_heartbeat_loop(self):
355
+ t_last_success = time.monotonic()
355
356
  while 1:
356
357
  t0 = time.monotonic()
357
358
  try:
358
- if await self._heartbeat_handle_cancellations():
359
- # got a cancellation event, fine to start another heartbeat immediately
360
- # since the cancellation queue should be empty on the worker server
361
- # however, we wait at least 1s to prevent short-circuiting the heartbeat loop
362
- # in case there is ever a bug. This means it will take at least 1s between
363
- # two subsequent cancellations on the same task at the moment
359
+ got_cancellation = await self._heartbeat_handle_cancellations()
360
+ t_last_success = time.monotonic()
361
+ if got_cancellation:
362
+ # Got a cancellation event, so it is fine to start another heartbeat immediately
363
+ # since the cancellation queue should be empty on the worker server.
364
+ # However, we wait at least 1s to prevent short-circuiting the heartbeat loop
365
+ # in case there is ever a bug.
366
+ # This means it will take at least 1s between two subsequent cancellations on the
367
+ # same task at the moment.
364
368
  await asyncio.sleep(1.0)
365
369
  continue
366
370
  except ClientClosed:
@@ -368,13 +372,25 @@ class _ContainerIOManager:
368
372
  break
369
373
  except Exception as exc:
370
374
  # don't stop heartbeat loop if there are transient exceptions!
371
- time_elapsed = time.monotonic() - t0
375
+ attempt_dur = time.monotonic() - t0
376
+ time_since_heartbeat_success = time.monotonic() - t_last_success
372
377
  error = exc
373
- logger.warning(f"Heartbeat attempt failed ({time_elapsed=}, {error=})")
378
+ logger.warning(
379
+ f"Modal Client → Modal Worker Heartbeat attempt failed "
380
+ f"({attempt_dur=:.2f}, {time_since_heartbeat_success=:.2f}, {error=})"
381
+ )
382
+ if time_since_heartbeat_success > HEARTBEAT_INTERVAL * 50:
383
+ trouble_mins = time_since_heartbeat_success / 60
384
+ logger.warning(
385
+ "Modal Client → Modal Worker heartbeat attempts have been failing for "
386
+ f"over {trouble_mins:.2f} minutes. "
387
+ "Container will eventually be marked unhealthy. "
388
+ "See https://modal.com/docs/guide/troubleshooting#heartbeat-timeout. "
389
+ )
374
390
 
375
391
  heartbeat_duration = time.monotonic() - t0
376
- time_until_next_hearbeat = max(0.0, HEARTBEAT_INTERVAL - heartbeat_duration)
377
- await asyncio.sleep(time_until_next_hearbeat)
392
+ time_until_next_heartbeat = max(0.0, HEARTBEAT_INTERVAL - heartbeat_duration)
393
+ await asyncio.sleep(time_until_next_heartbeat)
378
394
 
379
395
  async def _heartbeat_handle_cancellations(self) -> bool:
380
396
  # Return True if a cancellation event was received, in that case
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.74.18"
30
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.20"
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.74.18"
88
+ self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.20"
89
89
  ): ...
90
90
  def is_closed(self) -> bool: ...
91
91
  @property
modal/functions.pyi CHANGED
@@ -201,11 +201,11 @@ class Function(
201
201
 
202
202
  _call_generator_nowait: ___call_generator_nowait_spec[typing_extensions.Self]
203
203
 
204
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
204
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
205
205
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
206
206
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER: ...
207
207
 
208
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
208
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
209
209
 
210
210
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
211
211
  def __call__(self, *args, **kwargs) -> typing.Generator[typing.Any, None, None]: ...
@@ -220,19 +220,19 @@ class Function(
220
220
  self, *args: modal._functions.P.args, **kwargs: modal._functions.P.kwargs
221
221
  ) -> modal._functions.OriginalReturnType: ...
222
222
 
223
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
223
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
224
224
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
225
225
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
226
226
 
227
227
  _experimental_spawn: ___experimental_spawn_spec[
228
- modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
228
+ modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
229
229
  ]
230
230
 
231
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
231
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
232
232
  def __call__(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
233
233
  async def aio(self, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]: ...
234
234
 
235
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
235
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
236
236
 
237
237
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]: ...
238
238
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 0.74.18
3
+ Version: 0.74.20
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=sTJcc9EbDuCKSwg3tL6ZckFw9WWdlkXW8mId1IvJCNc,2846
3
3
  modal/_clustered_functions.py,sha256=kTf-9YBXY88NutC1akI-gCbvf01RhMPCw-zoOI_YIUE,2700
4
4
  modal/_clustered_functions.pyi,sha256=vllkegc99A0jrUOWa8mdlSbdp6uz36TsHhGxysAOpaQ,771
5
5
  modal/_container_entrypoint.py,sha256=DymOImhc3uGRkIq_qXmBsEbWMB4EBMpfuXzz2S4BcGg,29404
6
- modal/_functions.py,sha256=fvPz6oksYkPujA5Q9Lr13OM6pp3H5o4RfwenA-hYwsA,74236
6
+ modal/_functions.py,sha256=JGkxTOL6dcKIK2kCZfalzAO5JZXABVk0rc1Id1QgmCg,74900
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=JBIECWdfpRKCaCxVWZbC3Q1kF5Whk_EKvY9f4Y6AFyg,11446
@@ -22,7 +22,7 @@ modal/app.py,sha256=TnXw6EaejqwyJNawbtp177mG87ufJZClPoiIxO41Ioc,50664
22
22
  modal/app.pyi,sha256=8oj9DpTHySHymjy6aSat6IG-z2FF77mx_ls1dGbt3Qg,28222
23
23
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
24
24
  modal/client.py,sha256=U-YKSw0n7J1ZLREt9cbEJCtmHe5YoPKFxl0xlkan2yc,15565
25
- modal/client.pyi,sha256=V01HBD7Tc43waqJ7UFMAfM8DUqpQ1ykK6YFix40r2Tw,7593
25
+ modal/client.pyi,sha256=BZQXutYe2YeumUOXUEynCLRF0pQUn6ra-lfXV6GhRCo,7593
26
26
  modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
27
27
  modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
28
28
  modal/cls.py,sha256=GvaNl8R5UsH7Vg88WEOyerdjvZEPK7xxi3nqHlyOW_c,33497
@@ -39,7 +39,7 @@ modal/file_io.py,sha256=lcMs_E9Xfm0YX1t9U2wNIBPnqHRxmImqjLW1GHqVmyg,20945
39
39
  modal/file_io.pyi,sha256=NTRft1tbPSWf9TlWVeZmTlgB5AZ_Zhu2srWIrWr7brk,9445
40
40
  modal/file_pattern_matcher.py,sha256=trosX-Bp7dOubudN1bLLhRAoidWy1TcoaR4Pv8CedWw,6497
41
41
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
42
- modal/functions.pyi,sha256=2J7jPa2tQWhuUy67wg-MWvEx0rwrBNjX6UTEJbAUq_A,14855
42
+ modal/functions.pyi,sha256=I8dNJnvs6FguR8XAUqnMUg6X1214UzeLoAydZBrEa2g,14855
43
43
  modal/gpu.py,sha256=Kbhs_u49FaC2Zi0TjCdrpstpRtT5eZgecynmQi5IZVE,6752
44
44
  modal/image.py,sha256=I-9_YZL0SSfnuGPywa3-4PlxDmJ-53p7ce3gP74SrOA,92877
45
45
  modal/image.pyi,sha256=89zv12C1sFrJs7Es9SnX23_m208ASAdeNGCVTrhjzHI,25632
@@ -82,7 +82,7 @@ modal/volume.py,sha256=3c5_aJNJtgpsFRZWBjc0jwn8Zs0jo9V6UDmh6ifrbdA,40145
82
82
  modal/volume.pyi,sha256=juOVWGlgz7IeOY4M7jBhbeNRPA9xdGUwvA3AzlZUscQ,17958
83
83
  modal/_runtime/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
84
84
  modal/_runtime/asgi.py,sha256=KNarxvZI9z8fnmZl2vbkWTjnoLXs9kqOahkrbsTLkyc,22429
85
- modal/_runtime/container_io_manager.py,sha256=0yNO3HTVIM4f338rxJavD8nrRN7KhDpjz1jLux71MRY,43842
85
+ modal/_runtime/container_io_manager.py,sha256=6j0jO2-s9ShckM4SK45OapoQxWW9HQwQjFaBkXPJPwU,44763
86
86
  modal/_runtime/container_io_manager.pyi,sha256=3N9TOYa5hfufhJV5IiIhpvJYCeLZe-ne76-XuxcFLW0,16147
87
87
  modal/_runtime/execution_context.py,sha256=73Y5zH_o-MhVCrkJXakYVlFkKqCa2CWvqoHjOfJrJGg,3034
88
88
  modal/_runtime/execution_context.pyi,sha256=TAxQq7uLj7i9r9XbXgFZiSVBWxObFWN-rkssS0I7Vkk,661
@@ -145,7 +145,7 @@ modal/requirements/2024.10.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddR
145
145
  modal/requirements/PREVIEW.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddRo,296
146
146
  modal/requirements/README.md,sha256=9tK76KP0Uph7O0M5oUgsSwEZDj5y-dcUPsnpR0Sc-Ik,854
147
147
  modal/requirements/base-images.json,sha256=57vMSqzMbLBxw5tFWSaMiIkkVEps4JfX5PAtXGnkS4U,740
148
- modal-0.74.18.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
148
+ modal-0.74.20.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
149
149
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
150
150
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
151
151
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -170,9 +170,9 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
170
170
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
171
171
  modal_version/__init__.py,sha256=m94xZNWIjH8oUtJk4l9xfovzDJede2o7X-q0MHVECtM,470
172
172
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
173
- modal_version/_version_generated.py,sha256=sDEMGagYevBxtO8fkB4otAix4cPGy9fBDX0x4nrDUn4,149
174
- modal-0.74.18.dist-info/METADATA,sha256=RFCfJBy1rbDaUA-r0Rr0ns1KG_2hZzAlvRqsvtSd2uo,2474
175
- modal-0.74.18.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
176
- modal-0.74.18.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
177
- modal-0.74.18.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
178
- modal-0.74.18.dist-info/RECORD,,
173
+ modal_version/_version_generated.py,sha256=BKn7ZuwNEVnRMrgPy4ehXaEnZotZudYyVZG3M4X3XHo,149
174
+ modal-0.74.20.dist-info/METADATA,sha256=THx_ObWmE1MluRHvXeuaK6fw-sLfrkOqWo5xB2FohGg,2474
175
+ modal-0.74.20.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
176
+ modal-0.74.20.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
177
+ modal-0.74.20.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
178
+ modal-0.74.20.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  # Copyright Modal Labs 2025
2
2
 
3
3
  # Note: Reset this value to -1 whenever you make a minor `0.X` release of the client.
4
- build_number = 18 # git: e66672d
4
+ build_number = 20 # git: c5ebdcd