flytekit.configuration.ImageConfig#

class flytekit.configuration.ImageConfig(default_image=None, images=None)[source]#

We recommend you to use ImageConfig.auto(img_name=None) to create an ImageConfig. For example, ImageConfig.auto(img_name=””ghcr.io/flyteorg/flytecookbook:v1.0.0””) will create an ImageConfig.

ImageConfig holds available images which can be used at registration time. A default image can be specified along with optional additional images. Each image in the config must have a unique name.

Parameters
Return type

None

default_image#

The default image to be used as a container for task serialization.

Type

Optional[Image]

images#

Optional, additional images which can be used in task container definitions.

Type

List[Image]

Methods

classmethod auto(config_file=None, img_name=None)[source]#

Reads from config file or from img_name Note that this function does not take into account the flytekit default images (see the Dockerfiles at the base of this repo). To pick those up, see the auto_default_image function..

Parameters
Returns

Return type

flytekit.configuration.ImageConfig

classmethod auto_default_image()[source]#
Return type

flytekit.configuration.ImageConfig

classmethod create_from(default_image, other_images=None)[source]#
Parameters
Return type

flytekit.configuration.ImageConfig

find_image(name)[source]#

Return an image, by name, if it exists.

Return type

Optional[flytekit.configuration.Image]

classmethod from_dict(kvs, *, infer_missing=False)#
Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

dataclasses_json.api.A

classmethod from_images(default_image, m=None)[source]#

Allows you to programmatically create an ImageConfig. Usually only the default_image is required, unless your workflow uses multiple images

ImageConfig.from_dict(
    "ghcr.io/flyteorg/flytecookbook:v1.0.0",
     {
          "spark": "ghcr.io/flyteorg/myspark:...",
          "other": "...",
     }
)
Returns

Parameters
classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)#
Parameters

s (Union[str, bytes, bytearray]) –

Return type

dataclasses_json.api.A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)#
Parameters
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type

dataclasses_json.mm.SchemaF[dataclasses_json.mm.A]

to_dict(encode_json=False)#
Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)#
Parameters
Return type

str

static validate_image(_, param, values)[source]#

Validates the image to match the standard format. Also validates that only one default image is provided. a default image, is one that is specified as default=<image_uri> or just <image_uri>. All other images should be provided with a name, in the format name=<image_uri> This method can be used with the CLI

Parameters
  • _ (Any) – click argument, ignored here.

  • param (str) – the click argument, here should be “image”

  • values (tuple) – user-supplied images

Returns

Return type

flytekit.configuration.ImageConfig

Attributes

dataclass_json_config = None
default_image: Optional[flytekit.configuration.Image] = None
images: Optional[List[flytekit.configuration.Image]] = None