Skip to main content

ImageBuildEngine

ImageBuildEngine contains a list of builders that can be used to build an ImageSpec.

Attributes

AttributeTypeDescription
ImageBuilderTypetyping.Literal["local", "remote"]This attribute defines the allowed types for image builders, which can be either "local" or "remote".

Methods


image_exists()

@classmethod
def image_exists(
image: [Image](../../../../image/image.md?sid=flyte__image_image)
) - > Optional[str]

Checks if the specified image already exists in the registry. If the image is an unmodified Flyte default image, it is assumed to exist. If the image has no name or the tag is 'latest', the existence check is skipped.

Parameters

NameTypeDescription
image[Image](../../../../image/image.md?sid=flyte__image_image)The image object to check for existence.

Returns

TypeDescription
Optional[str]The URI of the image if it exists, otherwise None. If all checkers fail, it assumes the image exists and returns the image URI.

build()

@classmethod
def build(
image: [Image](../../../../image/image.md?sid=flyte__image_image),
builder: ImageBuildEngine.ImageBuilderType | None = None,
dry_run: bool = False,
force: bool = False,
wait: bool = True
) - > [ImageBuild](../../../../build/imagebuild.md?sid=flyte__build_imagebuild)

Build the image. Images to be tagged with latest will always be built. Otherwise, this engine will check the registry to see if the manifest exists.

Parameters

NameTypeDescription
image[Image](../../../../image/image.md?sid=flyte__image_image)The image object to be built.
builder`ImageBuildEngine.ImageBuilderTypeNone` = None
dry_runbool = FalseInstructs the builder not to perform an actual build. The specific behavior varies between different builders.
forcebool = FalseSkips the existence check and forces a rebuild. For the remote builder, this also sets overwrite_cache=True on the build run.
waitbool = TrueDetermines whether to wait for the build to complete. If False with the remote image builder, the function returns the build image task URL immediately.

Returns

TypeDescription
[ImageBuild](../../../../build/imagebuild.md?sid=flyte__build_imagebuild)An ImageBuild object with the image URI and remote run (if applicable).