modAL 1.4.1.dev0__py3-none-any.whl → 1.4.1.dev1__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/cli/container.py CHANGED
@@ -1,4 +1,5 @@
1
1
  # Copyright Modal Labs 2022
2
+ import warnings
2
3
  from datetime import datetime, timezone
3
4
  from typing import Optional, Union
4
5
 
@@ -185,20 +186,40 @@ async def logs(
185
186
  task_info_resp = await client.stub.TaskGetInfo(api_pb2.TaskGetInfoRequest(task_id=task_id))
186
187
  app_id = task_info_resp.app_id
187
188
 
189
+ if not task_info_resp.info.started_at:
190
+ # Unlikely race or Modal backend issue, don't treat as a usage exception
191
+ return
192
+ container_started_dt = datetime.fromtimestamp(task_info_resp.info.started_at, timezone.utc)
193
+
188
194
  now = datetime.now(timezone.utc)
189
195
  if all_logs:
190
- since_dt = datetime.fromtimestamp(task_info_resp.info.started_at, timezone.utc)
196
+ since_dt = container_started_dt
191
197
  if task_info_resp.info.finished_at:
192
198
  until_dt = datetime.fromtimestamp(task_info_resp.info.finished_at, timezone.utc)
193
199
  else:
194
200
  until_dt = now
195
201
  else:
196
- since_dt = _parse_time_arg(since, default=now) if since else None
197
- until_dt = _parse_time_arg(until, default=now) if until else None
202
+ since_dt = _parse_time_arg(since, default=container_started_dt)
203
+ if task_info_resp.info.finished_at:
204
+ default_until_dt = datetime.fromtimestamp(task_info_resp.info.finished_at, timezone.utc)
205
+ else:
206
+ default_until_dt = now
207
+ until_dt = _parse_time_arg(until, default=default_until_dt)
198
208
 
199
- if since_dt is not None and until_dt is not None and since_dt >= until_dt:
209
+ if since is not None and until is not None and since_dt >= until_dt:
210
+ # User provided both --since and --until, but did so incorrectly
200
211
  raise UsageError("--since must be before --until.")
201
212
 
213
+ if since is not None and until is None and since_dt >= until_dt:
214
+ # User provided only --since and it is after the container finished
215
+ warnings.warn("--since time is after the Container finished, no logs to fetch.", UserWarning)
216
+ return
217
+
218
+ if until is not None and since is None and since_dt >= until_dt:
219
+ # User provided only --until and it is before the Container started
220
+ warnings.warn("--until time is before the Container started, no logs to fetch.", UserWarning)
221
+ return
222
+
202
223
  if since_dt is not None:
203
224
  effective_until = until_dt or now
204
225
  if effective_until - since_dt > _MAX_FETCH_RANGE:
modal/client.pyi CHANGED
@@ -35,7 +35,7 @@ class _Client:
35
35
  server_url: str,
36
36
  client_type: int,
37
37
  credentials: typing.Optional[tuple[str, str]],
38
- version: str = "1.4.1.dev0",
38
+ version: str = "1.4.1.dev1",
39
39
  ):
40
40
  """mdmd:hidden
41
41
  The Modal client object is not intended to be instantiated directly by users.
@@ -171,7 +171,7 @@ class Client:
171
171
  server_url: str,
172
172
  client_type: int,
173
173
  credentials: typing.Optional[tuple[str, str]],
174
- version: str = "1.4.1.dev0",
174
+ version: str = "1.4.1.dev1",
175
175
  ):
176
176
  """mdmd:hidden
177
177
  The Modal client object is not intended to be instantiated directly by users.
modal/functions.pyi CHANGED
@@ -348,7 +348,7 @@ class Function(
348
348
 
349
349
  _call_generator: ___call_generator_spec
350
350
 
351
- class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
351
+ class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
352
352
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
353
353
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
354
354
  ...
@@ -357,7 +357,7 @@ class Function(
357
357
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
358
358
  ...
359
359
 
360
- remote: __remote_spec[modal._functions.ReturnType, modal._functions.P]
360
+ remote: __remote_spec[modal._functions.P, modal._functions.ReturnType]
361
361
 
362
362
  class __remote_gen_spec(typing_extensions.Protocol):
363
363
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -384,7 +384,7 @@ class Function(
384
384
  """
385
385
  ...
386
386
 
387
- class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
387
+ class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
388
388
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
389
389
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
390
390
 
@@ -407,7 +407,7 @@ class Function(
407
407
  """
408
408
  ...
409
409
 
410
- _experimental_spawn: ___experimental_spawn_spec[modal._functions.ReturnType, modal._functions.P]
410
+ _experimental_spawn: ___experimental_spawn_spec[modal._functions.P, modal._functions.ReturnType]
411
411
 
412
412
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER]):
413
413
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> None: ...
@@ -415,7 +415,7 @@ class Function(
415
415
 
416
416
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P]
417
417
 
418
- class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER]):
418
+ class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER]):
419
419
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
420
420
  """Calls the function with the given arguments, without waiting for the results.
421
421
 
@@ -436,7 +436,7 @@ class Function(
436
436
  """
437
437
  ...
438
438
 
439
- spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P]
439
+ spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType]
440
440
 
441
441
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
442
442
  """Return the inner Python object wrapped by this Modal Function."""
modal/mount.py CHANGED
@@ -699,16 +699,18 @@ Mount = synchronize_api(_Mount)
699
699
 
700
700
  def _create_client_mount():
701
701
  # TODO(erikbern): make this a static method on the Mount class
702
- import synchronicity
702
+ import importlib
703
703
 
704
- import modal
704
+ import synchronicity
705
705
 
706
- # Get the base_path because it also contains `modal_proto`.
707
- modal_parent_dir, _ = os.path.split(modal.__path__[0])
708
706
  client_mount = _Mount._new()
709
707
 
710
708
  for pkg_name in MODAL_PACKAGES:
711
- package_base_path = Path(modal_parent_dir) / pkg_name
709
+ # Look up each package's actual install path via importlib rather than
710
+ # assuming all packages are siblings of `modal`. In Bazel runfiles,
711
+ # modal and modal_proto live in different directories.
712
+ pkg_module = importlib.import_module(pkg_name)
713
+ package_base_path = Path(pkg_module.__path__[0])
712
714
  client_mount = client_mount.add_local_dir(
713
715
  package_base_path,
714
716
  remote_path=f"/pkg/{pkg_name}",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.4.1.dev0
3
+ Version: 1.4.1.dev1
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License-Expression: Apache-2.0
@@ -26,7 +26,7 @@ modal/app.pyi,sha256=vU6tli-ELcF3do5sCF-Wch1gFRP3xjPLoq112SCq_z8,54009
26
26
  modal/billing.py,sha256=B2zXa7KeMnpqi2AQINycEk-KSXVYaLTTTAQTtuf2Gfs,257
27
27
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
28
28
  modal/client.py,sha256=-IxazxLhdkNFAHS2AP2FpyTVpCDVR58RF6ecSVV59r0,14862
29
- modal/client.pyi,sha256=GfSLk0jEainM9P3KPh523qZQmeC-V2M3VaC4uZ53W6s,14930
29
+ modal/client.pyi,sha256=Y2lmvTB8EUZXdnD05uLwXQZq-9ZLcgmAoS-PR-ZjJiU,14930
30
30
  modal/cloud_bucket_mount.py,sha256=KkaJVy5vpO_u2NtDYtv1JM-M3y4J0UtWBapTDKpQRcA,6034
31
31
  modal/cloud_bucket_mount.pyi,sha256=mGDeEd1XvxGpCE6O5jRBSfIvMXvZ5AtIybea5k-0w9w,7560
32
32
  modal/cls.py,sha256=Yrl5b_tQhZMhc5avInM-i5UlGuqeog6Gs4rX2d9lLjI,40390
@@ -43,12 +43,12 @@ modal/file_io.py,sha256=AKTaKR4y2JO1vsmJ8tRxMhgJtHmtb-TCe1ZZYDte-w4,22221
43
43
  modal/file_io.pyi,sha256=DPaq0BhySaiCX3g56QHhyIMdU1izbfWsjpSp30JoJUU,15745
44
44
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
45
45
  modal/functions.py,sha256=EZRcHFfnoYbvawUJnAHF5nIvoo9GX2Djy7mUmOCXmXc,258
46
- modal/functions.pyi,sha256=9TLs1YOVU9LXCzy3ecuoQTY4Pu8hGBd0thvYqNdxws4,34316
46
+ modal/functions.pyi,sha256=rDN6WcJ6GYc4Hy5lrIXi1CUIiaQL8cmC49zuk4w9iJU,34316
47
47
  modal/image.py,sha256=-teX2JZYVId88KN-dH-orbdugDiyezlfmnrsvX1bgKg,112472
48
48
  modal/image.pyi,sha256=aCs8kbcZOSZp9eFHdG6CKD-3pplb9XBfVKaoBiH_rU0,79295
49
49
  modal/io_streams.py,sha256=JcYbvvjMZFugv53yHc9Id0N4nIvDMwV63ZtnN1bPmZc,30940
50
50
  modal/io_streams.pyi,sha256=aBxCcbHTprL08FLvPlkzu4bypCTT7xUdelNe5kc7OZY,18506
51
- modal/mount.py,sha256=S09M8zspoY6PwqabUFVSVgO3C5OpJZLTtWaXQthQPyo,34090
51
+ modal/mount.py,sha256=FkpAuQ8Mo2FHNwNtWhuNwvOmNDcUxk4wY9WGntLYa6k,34239
52
52
  modal/mount.pyi,sha256=HVNPL8po23Hulaj7Kdl5goakZbirN0ADv2nkLc8Hpn4,15748
53
53
  modal/network_file_system.py,sha256=huBlv5aY977qVavInhrgu-rJnwwytGEMJiT4DsdZMk4,13337
54
54
  modal/network_file_system.pyi,sha256=m4dzWF4rYUjKMcQllMn2FzTtMI6lR7lORSBancsx9t4,16059
@@ -149,7 +149,7 @@ modal/cli/billing.py,sha256=9Gj1H_Y8ziRAupJj90XhnPOw6nBMQfGU_Ys_ImheLYk,5690
149
149
  modal/cli/changelog.py,sha256=Ilzy1_3xF3y49w-_nwQkEVjoCupwdht7UuBrfV53nT0,5686
150
150
  modal/cli/cluster.py,sha256=FdCe4a0I_o9dT6Vi3r3k-19D64fOGEWFaPYFvBlnTBE,3337
151
151
  modal/cli/config.py,sha256=qPgj9qhQNClttO9DZEBYYxCmkaHv0WCP8O75u5eqZlY,1704
152
- modal/cli/container.py,sha256=YzwryjOTrMJ8PV44tH1Yo5XPgTyoiOxXEfMbHx-HksY,9768
152
+ modal/cli/container.py,sha256=Db51L3Z6FYq-tZixm8hod8TgamGMN8PN6ke8j_xgtAM,10819
153
153
  modal/cli/dashboard.py,sha256=MJdbZq1duj97Hu3p9NNLrPogC1Wm2wL3dmCjBUgrMtU,862
154
154
  modal/cli/dict.py,sha256=uRny4LtN7ej7ONir1cpSLGAC-gvZrIGO8bftbCeK0VE,4743
155
155
  modal/cli/entry_point.py,sha256=6NXIo2JzzQD7yZ57M6Y5KvL8QnYYGp0_T7YucOeqFQA,6262
@@ -173,7 +173,7 @@ modal/experimental/__init__.py,sha256=Wb1YoAKAnNxH_0c2wA0T12I7bSu9PSO2nS_LuLska7
173
173
  modal/experimental/flash.py,sha256=ATGhVO8AleJ-TOe2PGolI5T7zfCEtj0kl_ivMPp7Rqg,33362
174
174
  modal/experimental/flash.pyi,sha256=R4h2nQl7-oiwqq_twCp0YqID_LnPjPGqxywXvxbiLIk,17011
175
175
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
176
- modal-1.4.1.dev0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
176
+ modal-1.4.1.dev1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
177
177
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
178
178
  modal_docs/gen_cli_docs.py,sha256=5sVABw4uGUqPXjcWT0Nqjkpe5KLs89C3tFnla58-D0M,3756
179
179
  modal_docs/gen_cli_docs_main.py,sha256=UPGr7O1DYTIRLwfINe2rbdh89J3cPVTU1OWL-SjxnOQ,198
@@ -184,8 +184,8 @@ modal_docs/mdmd/mdmd.py,sha256=fNMtrFy0Z7KMXysr9v0w9H0OOuRVBW4-sqJu1pvRQm4,9583
184
184
  modal_docs/mdmd/signatures.py,sha256=XJaZrK7Mdepk5fdX51A8uENiLFNil85Ud0d4MH8H5f0,3218
185
185
  modal_proto/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
186
186
  modal_proto/api_grpc.py,sha256=rTv9MyBCWKTEbPEXk4h5sFoCbjrCTg0Gcwqc69gr2Ns,146012
187
- modal_proto/api_pb2.py,sha256=eGjknXw7PV3F4-3vZUZMT3u9qvaTITxg-mBcn-hj_WU,406441
188
- modal_proto/api_pb2.pyi,sha256=vrRnTkhs-ljO55p_FmSetY2uSVDGaI_mUZkVg2VmMM8,571829
187
+ modal_proto/api_pb2.py,sha256=bXZh5CrAOJ4sxNzrvXbU87Oirmeh2UCcjgCLwTf4R5M,406482
188
+ modal_proto/api_pb2.pyi,sha256=HsusJF-hH3S89Xa0GDOVWnoo-oC8J34Behfj4NDsYOE,571974
189
189
  modal_proto/api_pb2_grpc.py,sha256=nZWyLmjNkwq3H33-HWmARRLqfJ7Zgdr0ou7lYnRu2jg,314684
190
190
  modal_proto/api_pb2_grpc.pyi,sha256=safA3cDMsiSgIO6ig_x7tRkfqq3fKM2Apqsm6WbHnw4,73447
191
191
  modal_proto/modal_api_grpc.py,sha256=O743nwd1Li6I8Bz0qsJEtujl2tocgSEW70HY1N6n9VY,23061
@@ -195,10 +195,10 @@ modal_proto/task_command_router_pb2.py,sha256=uSSR8Y9Yp07cIL60ds7__wUr5rj1uL2CQY
195
195
  modal_proto/task_command_router_pb2.pyi,sha256=utNwipYgMZUEUuWBE7sJ5cNjRctozHKPKDRpLy6cPLM,25667
196
196
  modal_proto/task_command_router_pb2_grpc.py,sha256=YoinPeLc-uwFShig8gE0MluOi6n-qqJZQ3YvnKwKUz8,23194
197
197
  modal_proto/task_command_router_pb2_grpc.pyi,sha256=VUSE5l1O6ATPT8Wbj4M3faMiIy5vFxSoS5ZlKfTEpHc,7449
198
- modal_version/__init__.py,sha256=qKtPcmRup5kC8XWcFCzLkS5clWTSHkBOrkU3bWqaUHE,120
198
+ modal_version/__init__.py,sha256=3eckhcwFp0zlkdoJXzBjKav0gkIIikNduHVdRRvHjiU,120
199
199
  modal_version/__main__.py,sha256=nLUbubxKx7GXNzJIkTB7M7_u8080LyLM0IS0rzFkC_c,119
200
- modal-1.4.1.dev0.dist-info/METADATA,sha256=q7nsEe4iFIRPVdPSSsQz5R3r8hPFCymZg56A2UJL020,2364
201
- modal-1.4.1.dev0.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
202
- modal-1.4.1.dev0.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
203
- modal-1.4.1.dev0.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
204
- modal-1.4.1.dev0.dist-info/RECORD,,
200
+ modal-1.4.1.dev1.dist-info/METADATA,sha256=K8UMDlT_3tZMvqanq3mpyaVvhyirrE5Y4QK0b_mcQdI,2364
201
+ modal-1.4.1.dev1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
202
+ modal-1.4.1.dev1.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
203
+ modal-1.4.1.dev1.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
204
+ modal-1.4.1.dev1.dist-info/RECORD,,