flyte 0.2.0b27__py3-none-any.whl → 0.2.0b28__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.
flyte/_image.py CHANGED
@@ -575,6 +575,13 @@ class Image:
575
575
 
576
576
  :return:
577
577
  """
578
+ if addl_layer and self.dockerfile:
579
+ # We don't know how to inspect dockerfiles to know what kind it is (OS, python version, uv vs poetry, etc)
580
+ # so there's no guarantee any of the layering logic will work.
581
+ raise ValueError(
582
+ "Flyte current cannot add additional layers to a Dockerfile-based Image."
583
+ " Please amend the dockerfile directly."
584
+ )
578
585
  registry = registry if registry else self.registry
579
586
  name = name if name else self.name
580
587
  if addl_layer and (not name):
@@ -595,17 +602,35 @@ class Image:
595
602
  return img
596
603
 
597
604
  @classmethod
598
- def from_dockerfile(cls, file: Path, registry: str, name: str) -> Image:
605
+ def from_dockerfile(
606
+ cls, file: Path, registry: str, name: str, platform: Union[Architecture, Tuple[Architecture, ...], None] = None
607
+ ) -> Image:
599
608
  """
600
- Use this method to create a new image with the specified dockerfile
609
+ Use this method to create a new image with the specified dockerfile. Note you cannot use additional layers
610
+ after this, as the system doesn't attempt to parse/understand the Dockerfile, and what kind of setup it has
611
+ (python version, uv vs poetry, etc), so please put all logic into the dockerfile itself.
612
+
613
+ Also since Python sees paths as from the calling directory, please use Path objects with absolute paths. The
614
+ context for the builder will be the directory where the dockerfile is located.
601
615
 
602
616
  :param file: path to the dockerfile
603
617
  :param name: name of the image
604
618
  :param registry: registry to use for the image
619
+ :param platform: architecture to use for the image, default is linux/amd64, use tuple for multiple values
620
+ Example: ("linux/amd64", "linux/arm64")
605
621
 
606
622
  :return:
607
623
  """
608
- img = cls(dockerfile=file, registry=registry, name=name)
624
+ platform = _ensure_tuple(platform) if platform else None
625
+ file = file.absolute() # for clarity when debugging
626
+ kwargs = {
627
+ "dockerfile": file,
628
+ "registry": registry,
629
+ "name": name,
630
+ }
631
+ if platform:
632
+ kwargs["platform"] = platform
633
+ img = cls._new(**kwargs)
609
634
 
610
635
  return img
611
636
 
@@ -305,14 +305,14 @@ class DockerImageBuilder(ImageBuilder):
305
305
  return [LocalDockerCommandImageChecker, LocalPodmanCommandImageChecker, DockerAPIImageChecker]
306
306
 
307
307
  async def build_image(self, image: Image, dry_run: bool = False) -> str:
308
- if len(image._layers) == 0:
309
- logger.warning("No layers to build, returning the image URI as is.")
310
- return image.uri
311
-
312
308
  if image.dockerfile:
313
309
  # If a dockerfile is provided, use it directly
314
310
  return await self._build_from_dockerfile(image, push=True)
315
311
 
312
+ if len(image._layers) == 0:
313
+ logger.warning("No layers to build, returning the image URI as is.")
314
+ return image.uri
315
+
316
316
  return await self._build_image(
317
317
  image,
318
318
  push=True,
@@ -323,18 +323,27 @@ class DockerImageBuilder(ImageBuilder):
323
323
  """
324
324
  Build the image from a provided Dockerfile.
325
325
  """
326
+ assert image.dockerfile # for mypy
327
+
326
328
  command = [
327
329
  "docker",
330
+ "buildx",
328
331
  "build",
332
+ "--builder",
333
+ DockerImageBuilder._builder_name,
334
+ "-f",
335
+ str(image.dockerfile),
329
336
  "--tag",
330
337
  f"{image.uri}",
331
338
  "--platform",
332
339
  ",".join(image.platform),
333
- ".",
340
+ str(image.dockerfile.parent.absolute()), # Use the parent directory of the Dockerfile as the context
334
341
  ]
335
342
 
336
343
  if image.registry and push:
337
344
  command.append("--push")
345
+ else:
346
+ command.append("--load")
338
347
 
339
348
  concat_command = " ".join(command)
340
349
  logger.debug(f"Build command: {concat_command}")
flyte/_task.py CHANGED
@@ -20,8 +20,6 @@ from typing import (
20
20
  Union,
21
21
  )
22
22
 
23
- from flyteidl.core.tasks_pb2 import DataLoadingConfig
24
-
25
23
  from flyte._pod import PodTemplate
26
24
  from flyte.errors import RuntimeSystemError, RuntimeUserError
27
25
 
@@ -37,6 +35,8 @@ from ._timeout import TimeoutType
37
35
  from .models import NativeInterface, SerializationContext
38
36
 
39
37
  if TYPE_CHECKING:
38
+ from flyteidl.core.tasks_pb2 import DataLoadingConfig
39
+
40
40
  from ._task_environment import TaskEnvironment
41
41
 
42
42
  P = ParamSpec("P") # capture the function's parameters
flyte/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.2.0b27'
21
- __version_tuple__ = version_tuple = (0, 2, 0, 'b27')
20
+ __version__ = version = '0.2.0b28'
21
+ __version_tuple__ = version_tuple = (0, 2, 0, 'b28')
flyte/models.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import inspect
4
4
  import os
5
5
  import pathlib
6
- import tempfile
7
6
  from dataclasses import dataclass, field, replace
8
7
  from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, Literal, Optional, Tuple, Type
9
8
 
@@ -12,7 +11,6 @@ import rich.repr
12
11
  from flyte._docstring import Docstring
13
12
  from flyte._interface import extract_return_annotation
14
13
  from flyte._logging import logger
15
- from flyte._utils.helpers import base36_encode
16
14
 
17
15
  if TYPE_CHECKING:
18
16
  from flyteidl.core import literals_pb2
@@ -65,6 +63,8 @@ class ActionID:
65
63
  """Make a deterministic name"""
66
64
  import hashlib
67
65
 
66
+ from flyte._utils.helpers import base36_encode
67
+
68
68
  components = f"{self.name}-{input_hash}-{task_hash}-{task_call_seq}" + (f"-{group}" if group else "")
69
69
  logger.debug(f"----- Generating sub-action ID from components: {components}")
70
70
  # has the components into something deterministic
@@ -89,6 +89,8 @@ class RawDataPath:
89
89
  Create a new context attribute object, with local path given. Will be created if it doesn't exist.
90
90
  :return: Path to the temporary directory
91
91
  """
92
+ import tempfile
93
+
92
94
  match local_folder:
93
95
  case pathlib.Path():
94
96
  local_folder.mkdir(parents=True, exist_ok=True)
flyte/remote/_data.py CHANGED
@@ -79,16 +79,16 @@ async def _upload_single_file(
79
79
  except grpc.aio.AioRpcError as e:
80
80
  if e.code() == grpc.StatusCode.NOT_FOUND:
81
81
  raise RuntimeSystemError(
82
- "NotFound", f"Failed to get signed url for {fp}, please check your project and domain."
82
+ "NotFound", f"Failed to get signed url for {fp}, please check your project and domain: {e.details()}"
83
83
  )
84
84
  elif e.code() == grpc.StatusCode.PERMISSION_DENIED:
85
85
  raise RuntimeSystemError(
86
- "PermissionDenied", f"Failed to get signed url for {fp}, please check your permissions."
86
+ "PermissionDenied", f"Failed to get signed url for {fp}, please check your permissions: {e.details()}"
87
87
  )
88
88
  elif e.code() == grpc.StatusCode.UNAVAILABLE:
89
89
  raise InitializationError("EndpointUnavailable", "user", "Service is unavailable.")
90
90
  else:
91
- raise RuntimeSystemError(e.code().value, f"Failed to get signed url for {fp}.")
91
+ raise RuntimeSystemError(e.code().value, f"Failed to get signed url for {fp}: {e.details()}")
92
92
  except Exception as e:
93
93
  raise RuntimeSystemError(type(e).__name__, f"Failed to get signed url for {fp}.") from e
94
94
  logger.debug(f"Uploading to {make_hyperlink('signed url', resp.signed_url)} for {fp}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyte
3
- Version: 0.2.0b27
3
+ Version: 0.2.0b28
4
4
  Summary: Add your description here
5
5
  Author-email: Ketan Umare <kumare3@users.noreply.github.com>
6
6
  Requires-Python: >=3.10
@@ -8,7 +8,7 @@ flyte/_environment.py,sha256=oKVXLBX0ky2eE_wjBdzvQGI_2LiT2Nbx58ur7GMt50c,3231
8
8
  flyte/_excepthook.py,sha256=nXts84rzEg6-7RtFarbKzOsRZTQR4plnbWVIFMAEprs,1310
9
9
  flyte/_group.py,sha256=7o1j16sZyUmYB50mOiq1ui4TBAKhRpDqLakV8Ya1kw4,803
10
10
  flyte/_hash.py,sha256=Of_Zl_DzzzF2jp4ZsLm-3o-xJFCCJ8_GubmLI1htx78,504
11
- flyte/_image.py,sha256=P7eGdGHOHenxZlgT8LkHWjv35pPqrhrBqA__nJ_QNOI,31845
11
+ flyte/_image.py,sha256=RIjkZrj4q0-KVpYW_Z0Zd14Rn9WIQqOPG6DUGDH0ZKo,33258
12
12
  flyte/_initialize.py,sha256=xKl_LYMluRt21wWqa6RTKuLo0_DCbSaTfUk27_brtNk,18232
13
13
  flyte/_interface.py,sha256=1B9zIwFDjiVp_3l_mk8EpA4g3Re-6DUBEBi9z9vDvPs,3504
14
14
  flyte/_logging.py,sha256=_yNo-Nx2yzh0MLoZGbnIYHGKei4wtQmSGM0lE30Ev7w,3662
@@ -19,16 +19,16 @@ flyte/_retry.py,sha256=rfLv0MvWxzPByKESTglEmjPsytEAKiIvvmzlJxXwsfE,941
19
19
  flyte/_reusable_environment.py,sha256=f8Y1GilUwGcXH4n2Fckrnx0SrZmhk3nCfoe-TqUKivI,3740
20
20
  flyte/_run.py,sha256=htq4zyltmaWL-B_IkLX5joSzfB-pLTHQ5DtI49c220I,24247
21
21
  flyte/_secret.py,sha256=ogXmCNfYYIphV6p-2iiWmwr2cNUES5Cq01PPjY6uQNA,3217
22
- flyte/_task.py,sha256=hYId6MoJiLsGv3otAfXAnjIc1u39LRSSapHt0GrD-_Q,18014
22
+ flyte/_task.py,sha256=aZpnLLMZLNmPPS6-_pafBEgOtvg7Z-kwI1fhexfI8JM,18018
23
23
  flyte/_task_environment.py,sha256=qYcTG9452a_POueQCHqkTafN4HG8Xo7KkBPwSMkKRRU,8536
24
24
  flyte/_task_plugins.py,sha256=9MH3nFPOH_e8_92BT4sFk4oyAnj6GJFvaPYWaraX7yE,1037
25
25
  flyte/_timeout.py,sha256=zx5sFcbYmjJAJbZWSGzzX-BpC9HC7Jfs35T7vVhKwkk,1571
26
26
  flyte/_tools.py,sha256=tWb0sx3t3mm4jbaQVjCTc9y39oR_Ibo3z_KHToP3Lto,966
27
27
  flyte/_trace.py,sha256=C788bgoSc3st8kE8Cae2xegnLx2CT6uuRKKfaDrDUys,5122
28
- flyte/_version.py,sha256=1OZxtIinrzel7addSNq8I2MVEKwGJOtZ9VCRKrmBqxE,521
28
+ flyte/_version.py,sha256=17NKFMLoy5Yz1urofNe-xHRTlzSKuLO6mP2yK1P7AxI,521
29
29
  flyte/errors.py,sha256=IUXHuEgszis9ZyhBUOSSlZx7VPQk0BF4N875yj1FBKo,4963
30
30
  flyte/extend.py,sha256=GB4ZedGzKa30vYWRVPOdxEeK62xnUVFY4z2tD6H9eEw,376
31
- flyte/models.py,sha256=yqLwln7G30tpV5U8Zji4z8K4u7DbSCDdFo1q-F77WuM,15207
31
+ flyte/models.py,sha256=g8QBIF9JjrNxDR_R_esAFG72hrq3fFV42bb7Nm0E0Zo,15225
32
32
  flyte/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  flyte/_bin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  flyte/_bin/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
@@ -53,7 +53,7 @@ flyte/_internal/controllers/remote/_core.py,sha256=FJe1ZAWu_0w5SQUFgAHY4Hjjf_Aju
53
53
  flyte/_internal/controllers/remote/_informer.py,sha256=StiPcQLLW0h36uEBhKsupMY79EeFCKA3QQzvv2IyvRo,14188
54
54
  flyte/_internal/controllers/remote/_service_protocol.py,sha256=B9qbIg6DiGeac-iSccLmX_AL2xUgX4ezNUOiAbSy4V0,1357
55
55
  flyte/_internal/imagebuild/__init__.py,sha256=dwXdJ1jMhw9RF8itF7jkPLanvX1yCviSns7hE5eoIts,102
56
- flyte/_internal/imagebuild/docker_builder.py,sha256=rQXbWG9eKcxBzjbd2pbkEJ1OqtDPeBxDGLqoluQvm5U,16129
56
+ flyte/_internal/imagebuild/docker_builder.py,sha256=idA3HNmYrsX0qaYjmiJVJEuwYYjZfYoIEMB7aogwWYs,16468
57
57
  flyte/_internal/imagebuild/image_builder.py,sha256=dXBXl62qcPabus6dR3eP8P9mBGNhpZHZ2Xm12AymKkk,11150
58
58
  flyte/_internal/imagebuild/remote_builder.py,sha256=JBeek4B4a6tUeyAD8dgQKVv4myMdeERqmxMStABVWN0,10452
59
59
  flyte/_internal/resolvers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -182,7 +182,7 @@ flyte/io/_structured_dataset/structured_dataset.py,sha256=ddRjz36RhNxIy0gakzdLSt
182
182
  flyte/remote/__init__.py,sha256=y9eke9JzEJkygk8eKZjSj44fJGlyepuW4i-j6lbCAPY,617
183
183
  flyte/remote/_action.py,sha256=r2rLmJoPUIOCUoBUy4RG_1mMYmC4uiI1tKXuZZ9iC9k,23564
184
184
  flyte/remote/_console.py,sha256=avmELJPx8nQMAVPrHlh6jEIRPjrMwFpdZjJsWOOa9rE,660
185
- flyte/remote/_data.py,sha256=h3oR2ZmwOEg6HpWyYVbVcHBs8_LX2RmRolHxgwBjlQE,6121
185
+ flyte/remote/_data.py,sha256=zYXXlqEvPdsC44Gm7rP_hQjRgVe3EFfhZNEWKF0p4MQ,6163
186
186
  flyte/remote/_logs.py,sha256=xBx4ozfY-NBMw3uD5o5YLsI4no10zGroNMcx1Oj0ef0,6689
187
187
  flyte/remote/_project.py,sha256=CFNTGpgXU3X599tkJ_oxijs9zPzzCWOB6mAWn6WeDEU,2828
188
188
  flyte/remote/_run.py,sha256=HzpoDthSw50vuT-gmzyzdkf28H4SyBgMr0d6bFSmyNU,9747
@@ -226,9 +226,9 @@ flyte/types/_renderer.py,sha256=ygcCo5l60lHufyQISFddZfWwLlQ8kJAKxUT_XnR_6dY,4818
226
226
  flyte/types/_string_literals.py,sha256=NlG1xV8RSA-sZ-n-IFQCAsdB6jXJOAKkHWtnopxVVDk,4231
227
227
  flyte/types/_type_engine.py,sha256=QBH-XNwyBHvKP8PjI_BaEPneonfoeNS86aMld87YLMA,97278
228
228
  flyte/types/_utils.py,sha256=pbts9E1_2LTdLygAY0UYTLYJ8AsN3BZyviSXvrtcutc,2626
229
- flyte-0.2.0b27.data/scripts/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
230
- flyte-0.2.0b27.dist-info/METADATA,sha256=vMxmOvEOeHKQwuOpB0A5vFPtvf7mlBbJhq8RiZ2MsTg,5857
231
- flyte-0.2.0b27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
232
- flyte-0.2.0b27.dist-info/entry_points.txt,sha256=MIq2z5dBurdCJfpXfMKzgBv7sJOakKRYxr8G0cMiTrg,75
233
- flyte-0.2.0b27.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
234
- flyte-0.2.0b27.dist-info/RECORD,,
229
+ flyte-0.2.0b28.data/scripts/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
230
+ flyte-0.2.0b28.dist-info/METADATA,sha256=EL-2mFQ2imGb8w-oib02h7qXZdE1Pcen75jRIeiJSyI,5857
231
+ flyte-0.2.0b28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
232
+ flyte-0.2.0b28.dist-info/entry_points.txt,sha256=MIq2z5dBurdCJfpXfMKzgBv7sJOakKRYxr8G0cMiTrg,75
233
+ flyte-0.2.0b28.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
234
+ flyte-0.2.0b28.dist-info/RECORD,,