modAL 1.6.3.dev1__py3-none-any.whl → 1.6.3.dev3__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/client.pyi CHANGED
@@ -80,7 +80,7 @@ class _Client:
80
80
  server_url: str,
81
81
  client_type: int,
82
82
  credentials: typing.Optional[tuple[str, str]],
83
- version: str = "1.6.3.dev1",
83
+ version: str = "1.6.3.dev3",
84
84
  *,
85
85
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
86
86
  ):
@@ -290,7 +290,7 @@ class Client:
290
290
  server_url: str,
291
291
  client_type: int,
292
292
  credentials: typing.Optional[tuple[str, str]],
293
- version: str = "1.6.3.dev1",
293
+ version: str = "1.6.3.dev3",
294
294
  *,
295
295
  oauth_credentials: typing.Optional[_OAuthCredentials] = None,
296
296
  ):
@@ -137,7 +137,8 @@ async def call_with_retries_on_transient_errors(
137
137
  the caller to decide whether to further translate the surfaced
138
138
  exception (e.g., into a TimeoutError) based on the deadline check.
139
139
  The caller is also responsible for propagating the remaining budget
140
- into `func()` (typically as the per-call gRPC timeout).
140
+ into `func()` (typically as the per-call gRPC timeout). A server-requested
141
+ throttle wait that doesn't fit before the deadline raises a TimeoutError.
141
142
  rpc_name: RPC name to include in retry diagnostics.
142
143
  exec_id: Execution ID to include in retry diagnostics, for correlating
143
144
  the retries of concurrent executions.
@@ -170,10 +171,8 @@ async def call_with_retries_on_transient_errors(
170
171
  return False
171
172
  return fits_deadline(0.0)
172
173
 
173
- def can_retry_throttled(delay: float) -> bool:
174
- if max_throttle_wait is not None and throttle_wait_total + delay > max_throttle_wait:
175
- return False
176
- return fits_deadline(delay)
174
+ def fits_throttle_budget(delay: float) -> bool:
175
+ return max_throttle_wait is None or throttle_wait_total + delay <= max_throttle_wait
177
176
 
178
177
  async def sleep_and_advance(e: Exception, *, count_failure: bool = True, throttle_delay: float | None = None):
179
178
  nonlocal delay_secs, num_retries, num_throttled_retries, throttle_wait_total, consecutive_failures, warned
@@ -215,7 +214,9 @@ async def call_with_retries_on_transient_errors(
215
214
  except GRPCError as e:
216
215
  retry_after = server_retry_after(e)
217
216
  if retry_after is not None:
218
- if not can_retry_throttled(retry_after):
217
+ if not fits_deadline(retry_after):
218
+ raise ModalTimeoutError("Timeout expired") from e
219
+ if not fits_throttle_budget(retry_after):
219
220
  raise
220
221
  # Throttling says nothing about the connection's health.
221
222
  await sleep_and_advance(e, count_failure=False, throttle_delay=retry_after)
@@ -1244,13 +1245,7 @@ class TaskCommandRouterClient:
1244
1245
  timeout_deadline=timeout_deadline,
1245
1246
  )
1246
1247
  except Exception as exc:
1247
- # A throttled call whose server-requested wait doesn't fit the remaining
1248
- # budget is given up without sleeping, so treat it as a timeout too.
1249
- retry_after = server_retry_after_secs(getattr(exc, "_grpc_details", None)) or 0.0
1250
- if (
1251
- time.monotonic() + retry_after >= timeout_deadline
1252
- or getattr(exc, "_grpc_status", None) == Status.DEADLINE_EXCEEDED
1253
- ):
1248
+ if time.monotonic() >= timeout_deadline or getattr(exc, "_grpc_status", None) == Status.DEADLINE_EXCEEDED:
1254
1249
  raise ModalTimeoutError("Timeout expired")
1255
1250
  raise
1256
1251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.6.3.dev1
3
+ Version: 1.6.3.dev3
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -39,7 +39,7 @@ modal/billing.py,sha256=E1-P_P8bJFLp-bTaggYd4BaaViImPB5UdtXiY8VeAZQ,390
39
39
  modal/billing.pyi,sha256=4m7VLYNS8IiJ2I3CJx0awvrOM6BILWRVLfdeqtAYr8M,7189
40
40
  modal/call_graph.py,sha256=XGALIDn1bLchWo_goyX23bcPjzCZcfqKUo8INIfDapo,1775
41
41
  modal/client.py,sha256=cstrL0wpXCZmcvRs7Sy3QRw9Vz8zkZy8NNk0tPe38sk,22852
42
- modal/client.pyi,sha256=pNXtx3pvkU8Qj1VkXAtIWBbL33dCniPHemcTcou0_qw,23488
42
+ modal/client.pyi,sha256=JMUxjhwik00qa9LbRsaInE8D8h55Tvf_KdhDfcpvNgs,23488
43
43
  modal/cloud_bucket_mount.py,sha256=ZOg69dhIFcJcwim4JP-6s1tqwOYAfgS9806jRpspifw,7511
44
44
  modal/cloud_bucket_mount.pyi,sha256=HoPe_NG5jYdVfmTNY-ZJ3-C8Eo_FzJovl9orJRjkGbE,10252
45
45
  modal/cls.py,sha256=JfDAUMrkhasm26lK7kDUNarXZA_7AvZrymf7XNSGTDM,41777
@@ -203,11 +203,11 @@ modal/sandbox/_filesystem.py,sha256=GdkMNVahPpUpfuY04HwWWwZyMID3bcut7PHXNWOIpYg,
203
203
  modal/sandbox/_sandbox.py,sha256=StQldIqilL0y9sAqNN_tzQ6pV6GWmbP3k4dYHOs5YvQ,113729
204
204
  modal/sandbox/_sidecar.py,sha256=c_vbP_ORl7POIFw3rvDZsrkBy53oJ03RxgID243p8Cw,28069
205
205
  modal/sandbox/_snapshot.py,sha256=8mB6FOecXEbgTC9dyogIEGCxTdjemuFsyfVFQyQ2Cp8,3105
206
- modal/sandbox/_task_command_router_client.py,sha256=qhFXy8eyGIxwxRFZkTsxJVxsAc8cWPhovOwcrHSZFq0,56712
206
+ modal/sandbox/_task_command_router_client.py,sha256=7c4a8sutJJYAXTgBCnUo0ZjyidAvvsBImHvTQTU9zrM,56564
207
207
  modal/sandbox/sandbox.py,sha256=4ekghND9qUGf5wtIQH4mVa6PHGjHgY0UN5RKryOM05k,683
208
208
  modal/sandbox/sandbox.pyi,sha256=LWQq7mpZXYVQHKjWi9azwddlclONcdYGZ7EpPgDD0-Y,150341
209
209
  modal/skills/modal/SKILL.md,sha256=Bm-0BPTYppJoeQzA-N-Re8L6-nKnV6gspJXMl4cD0P0,5490
210
- modal-1.6.3.dev1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
210
+ modal-1.6.3.dev3.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
211
211
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
212
212
  modal_docs/gen_cli_docs.py,sha256=9-b8vl2EsLWD9zJqpCK8IUi5h44Bjn3i3rSdedZV4bA,6415
213
213
  modal_docs/gen_cli_docs_main.py,sha256=UPGr7O1DYTIRLwfINe2rbdh89J3cPVTU1OWL-SjxnOQ,198
@@ -219,22 +219,22 @@ modal_docs/mdmd/mdmd.py,sha256=8bwE9SOnvsY9hEXvyE3Rx0L0XhvENpPNtkWCTJCA-pw,29269
219
219
  modal_docs/mdmd/signatures.py,sha256=OASroKle763Kfumn4Ek4PABJXEGP56JMCTug44QoBx4,11327
220
220
  modal_docs/mdmd/types.py,sha256=tv7fvziPr-MeDzOp4e2pK5h3d1DXTUOO74rPqDoBn6g,736
221
221
  modal_proto/__init__.py,sha256=Hkou4lcD5tArEkW_9v9KZhLY7fl0fA9-O28beKU55pg,396
222
- modal_proto/api_grpc.py,sha256=2apBkgs2G86IrW4qJCxIGk7EOH-N99FrGuRdEZsG8mk,209554
223
- modal_proto/api_pb2.py,sha256=WVqXaIN3OMJpInUbXj5qDvgJEl7cADa1kHfdEvzqozo,607556
224
- modal_proto/api_pb2.pyi,sha256=ClMVnxVRcKY6PvV8zJtGGy1gh17daVJfQnpQiIbArkI,842160
225
- modal_proto/api_pb2_grpc.py,sha256=V8X-LVyMUUgK8_fz6l96LOtOwRtdxgDvNaPatgrKWu8,448419
226
- modal_proto/api_pb2_grpc.pyi,sha256=zPleMbOEfMvYo-bN3VOIjoOYgYL2uncDpPxXtC85g94,105391
227
- modal_proto/modal_api_grpc.py,sha256=70vJTOo756_hHoE_svqkbrqO-FnTAEJhQ-D6LANg43M,32964
222
+ modal_proto/api_grpc.py,sha256=ON1VhznpxU1aYKG9NuYzdS9xEyKJGHPEcnl_KpFqKT8,211869
223
+ modal_proto/api_pb2.py,sha256=i1ZHj6Ib_6H9A4-Nc2A_kYJ9iuTqPFr9h5mSgNREKDI,615874
224
+ modal_proto/api_pb2.pyi,sha256=FPb1Rk2zuIBDlNQN0ddYYWmYgbylq7dXsGXBEMO5Cz0,854938
225
+ modal_proto/api_pb2_grpc.py,sha256=57bvHFN8Jx7fvLuiR7M7nfhBeC19vV0ff_G1StRzvLA,453372
226
+ modal_proto/api_pb2_grpc.pyi,sha256=SRpUAPcooPEgclr12YXQtHwKkvDtflGRTz0bSCgGjSo,106570
227
+ modal_proto/modal_api_grpc.py,sha256=UtaD1fZ6XaGpnfXgfbPHUz89gLtBIOH-3reuuW8-e_A,33314
228
228
  modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
229
  modal_proto/task_command_router_grpc.py,sha256=LOkoiKSoyesfTsViPwDI88-V8bG4oDH6S2MBm84hMLA,22335
230
230
  modal_proto/task_command_router_pb2.py,sha256=ysC0d8p3YxwyOpP3B-qDlvE81Yo4ntQiwiGZ8qSb0kg,43514
231
231
  modal_proto/task_command_router_pb2.pyi,sha256=FDcd5t3ZCmQHUjefOzg07iglrgKYcBrzFvdKIWsEMHI,50628
232
232
  modal_proto/task_command_router_pb2_grpc.py,sha256=8iGUGwEVbqOsZWPJ7OsQ9OKUGaSCf9Dr2tvb04Ww6d4,44620
233
233
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=26Fq9RQo09B9KLHsgdpRuw-I6Z4-2jrXLQkuDzB-moI,15097
234
- modal_version/__init__.py,sha256=u2qrbxI_YL-KZRwsXsYMQsHn-MkQSRROMWlQ6dxqBho,120
234
+ modal_version/__init__.py,sha256=5GsNaeA620SiVlMRXrW3DTAE1pZK0GVmOUb-oNc_dyA,120
235
235
  modal_version/__main__.py,sha256=nLUbubxKx7GXNzJIkTB7M7_u8080LyLM0IS0rzFkC_c,119
236
- modal-1.6.3.dev1.dist-info/METADATA,sha256=_aXXgr3hBF7sUeTXQ7uIAiJ4sE9um9agCrMRqhOGW8Y,2577
237
- modal-1.6.3.dev1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
238
- modal-1.6.3.dev1.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
239
- modal-1.6.3.dev1.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
240
- modal-1.6.3.dev1.dist-info/RECORD,,
236
+ modal-1.6.3.dev3.dist-info/METADATA,sha256=Vju-PUh4UoThF-iMhMKgz2_IMdvUDJ4GMA9rT8LbsAk,2577
237
+ modal-1.6.3.dev3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
238
+ modal-1.6.3.dev3.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
239
+ modal-1.6.3.dev3.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
240
+ modal-1.6.3.dev3.dist-info/RECORD,,
modal_proto/api_grpc.py CHANGED
@@ -127,6 +127,18 @@ class ModalClientBase(abc.ABC):
127
127
  async def AttemptStart(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AttemptStartRequest, modal_proto.api_pb2.AttemptStartResponse]') -> None:
128
128
  pass
129
129
 
130
+ @abc.abstractmethod
131
+ async def AuditLogV2Count(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AuditLogV2CountRequest, modal_proto.api_pb2.AuditLogV2CountResponse]') -> None:
132
+ pass
133
+
134
+ @abc.abstractmethod
135
+ async def AuditLogV2List(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AuditLogV2ListRequest, modal_proto.api_pb2.AuditLogV2ListResponse]') -> None:
136
+ pass
137
+
138
+ @abc.abstractmethod
139
+ async def AuditLogV2Plan(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AuditLogV2PlanRequest, modal_proto.api_pb2.AuditLogV2PlanResponse]') -> None:
140
+ pass
141
+
130
142
  @abc.abstractmethod
131
143
  async def AuthTokenGet(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.AuthTokenGetRequest, modal_proto.api_pb2.AuthTokenGetResponse]') -> None:
132
144
  pass
@@ -1251,6 +1263,24 @@ class ModalClientBase(abc.ABC):
1251
1263
  modal_proto.api_pb2.AttemptStartRequest,
1252
1264
  modal_proto.api_pb2.AttemptStartResponse,
1253
1265
  ),
1266
+ '/modal.client.ModalClient/AuditLogV2Count': grpclib.const.Handler(
1267
+ self.AuditLogV2Count,
1268
+ grpclib.const.Cardinality.UNARY_UNARY,
1269
+ modal_proto.api_pb2.AuditLogV2CountRequest,
1270
+ modal_proto.api_pb2.AuditLogV2CountResponse,
1271
+ ),
1272
+ '/modal.client.ModalClient/AuditLogV2List': grpclib.const.Handler(
1273
+ self.AuditLogV2List,
1274
+ grpclib.const.Cardinality.UNARY_UNARY,
1275
+ modal_proto.api_pb2.AuditLogV2ListRequest,
1276
+ modal_proto.api_pb2.AuditLogV2ListResponse,
1277
+ ),
1278
+ '/modal.client.ModalClient/AuditLogV2Plan': grpclib.const.Handler(
1279
+ self.AuditLogV2Plan,
1280
+ grpclib.const.Cardinality.UNARY_UNARY,
1281
+ modal_proto.api_pb2.AuditLogV2PlanRequest,
1282
+ modal_proto.api_pb2.AuditLogV2PlanResponse,
1283
+ ),
1254
1284
  '/modal.client.ModalClient/AuthTokenGet': grpclib.const.Handler(
1255
1285
  self.AuthTokenGet,
1256
1286
  grpclib.const.Cardinality.UNARY_UNARY,
@@ -2859,6 +2889,24 @@ class ModalClientStub:
2859
2889
  modal_proto.api_pb2.AttemptStartRequest,
2860
2890
  modal_proto.api_pb2.AttemptStartResponse,
2861
2891
  )
2892
+ self.AuditLogV2Count = grpclib.client.UnaryUnaryMethod(
2893
+ channel,
2894
+ '/modal.client.ModalClient/AuditLogV2Count',
2895
+ modal_proto.api_pb2.AuditLogV2CountRequest,
2896
+ modal_proto.api_pb2.AuditLogV2CountResponse,
2897
+ )
2898
+ self.AuditLogV2List = grpclib.client.UnaryUnaryMethod(
2899
+ channel,
2900
+ '/modal.client.ModalClient/AuditLogV2List',
2901
+ modal_proto.api_pb2.AuditLogV2ListRequest,
2902
+ modal_proto.api_pb2.AuditLogV2ListResponse,
2903
+ )
2904
+ self.AuditLogV2Plan = grpclib.client.UnaryUnaryMethod(
2905
+ channel,
2906
+ '/modal.client.ModalClient/AuditLogV2Plan',
2907
+ modal_proto.api_pb2.AuditLogV2PlanRequest,
2908
+ modal_proto.api_pb2.AuditLogV2PlanResponse,
2909
+ )
2862
2910
  self.AuthTokenGet = grpclib.client.UnaryUnaryMethod(
2863
2911
  channel,
2864
2912
  '/modal.client.ModalClient/AuthTokenGet',