flytekit.image_spec.image_spec
Directory
Classes
Class | Description |
---|---|
CopyFileDetection |
Create a collection of name/value pairs. |
ImageBuildEngine |
ImageBuildEngine contains a list of builders that can be used to build an ImageSpec. |
ImageSpec |
This class is used to specify the docker image that will be used to run the task. |
ImageSpecBuilder |
None. |
Version |
This class abstracts handling of a project’s versions. |
cached_property |
None. |
Errors
flytekit.image_spec.image_spec.CopyFileDetection
Create a collection of name/value pairs.
Example enumeration:
class Color(Enum): … RED = 1 … BLUE = 2 … GREEN = 3
Access them by:
- attribute access:
Color.RED <Color.RED: 1>
- value lookup:
Color(1) <Color.RED: 1>
- name lookup:
Color[‘RED’] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
len(Color) 3
list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
flytekit.image_spec.image_spec.FlyteAssertion
Assertion failed.
def FlyteAssertion(
args,
timestamp: typing.Optional[float],
):
Parameter | Type |
---|---|
args |
*args |
timestamp |
typing.Optional[float] |
Properties
Property | Type | Description |
---|---|---|
timestamp |
flytekit.image_spec.image_spec.ImageBuildEngine
ImageBuildEngine contains a list of builders that can be used to build an ImageSpec.
Methods
Method | Description |
---|---|
build() |
None |
get_registry() |
None |
register() |
None |
build()
def build(
image_spec: flytekit.image_spec.image_spec.ImageSpec,
):
Parameter | Type |
---|---|
image_spec |
flytekit.image_spec.image_spec.ImageSpec |
get_registry()
def get_registry()
register()
def register(
builder_type: str,
image_spec_builder: flytekit.image_spec.image_spec.ImageSpecBuilder,
priority: int,
):
Parameter | Type |
---|---|
builder_type |
str |
image_spec_builder |
flytekit.image_spec.image_spec.ImageSpecBuilder |
priority |
int |
flytekit.image_spec.image_spec.ImageSpec
This class is used to specify the docker image that will be used to run the task.
def ImageSpec(
name: str,
python_version: str,
builder: typing.Optional[str],
source_root: typing.Optional[str],
env: typing.Optional[typing.Dict[str, str]],
registry: typing.Optional[str],
packages: typing.Optional[typing.List[str]],
conda_packages: typing.Optional[typing.List[str]],
conda_channels: typing.Optional[typing.List[str]],
requirements: typing.Optional[str],
apt_packages: typing.Optional[typing.List[str]],
cuda: typing.Optional[str],
cudnn: typing.Optional[str],
base_image: typing.Union[str, ForwardRef('ImageSpec'), NoneType],
platform: str,
pip_index: typing.Optional[str],
pip_extra_index_url: typing.Optional[typing.List[str]],
pip_secret_mounts: typing.Optional[typing.List[typing.Tuple[str, str]]],
pip_extra_args: typing.Optional[str],
registry_config: typing.Optional[str],
entrypoint: typing.Optional[typing.List[str]],
commands: typing.Optional[typing.List[str]],
tag_format: typing.Optional[str],
source_copy_mode: typing.Optional[flytekit.constants.CopyFileDetection],
copy: typing.Optional[typing.List[str]],
python_exec: typing.Optional[str],
):
Parameter | Type |
---|---|
name |
str |
python_version |
str |
builder |
typing.Optional[str] |
source_root |
typing.Optional[str] |
env |
typing.Optional[typing.Dict[str, str]] |
registry |
typing.Optional[str] |
packages |
typing.Optional[typing.List[str]] |
conda_packages |
typing.Optional[typing.List[str]] |
conda_channels |
typing.Optional[typing.List[str]] |
requirements |
typing.Optional[str] |
apt_packages |
typing.Optional[typing.List[str]] |
cuda |
typing.Optional[str] |
cudnn |
typing.Optional[str] |
base_image |
typing.Union[str, ForwardRef('ImageSpec'), NoneType] |
platform |
str |
pip_index |
typing.Optional[str] |
pip_extra_index_url |
typing.Optional[typing.List[str]] |
pip_secret_mounts |
typing.Optional[typing.List[typing.Tuple[str, str]]] |
pip_extra_args |
typing.Optional[str] |
registry_config |
typing.Optional[str] |
entrypoint |
typing.Optional[typing.List[str]] |
commands |
typing.Optional[typing.List[str]] |
tag_format |
typing.Optional[str] |
source_copy_mode |
typing.Optional[flytekit.constants.CopyFileDetection] |
copy |
typing.Optional[typing.List[str]] |
python_exec |
typing.Optional[str] |
Methods
Method | Description |
---|---|
exist() |
Check if the image exists in the registry |
force_push() |
Builder that returns a new image spec with force push enabled |
from_env() |
Create ImageSpec with the environment’s Python version and packages pinned to the ones in the environment |
image_name() |
Full image name with tag |
is_container() |
Check if the current container image in the pod is built from current image spec |
with_apt_packages() |
Builder that returns a new image spec with an additional list of apt packages that will be executed during the building process |
with_commands() |
Builder that returns a new image spec with an additional list of commands that will be executed during the building process |
with_copy() |
Builder that returns a new image spec with the source files copied to the destination directory |
with_packages() |
Builder that returns a new image speck with additional python packages that will be installed during the building process |
exist()
def exist()
Check if the image exists in the registry. Return True if the image exists in the registry, False otherwise. Return None if failed to check if the image exists due to the permission issue or other reasons.
force_push()
def force_push()
Builder that returns a new image spec with force push enabled.
from_env()
def from_env(
pinned_packages: typing.Optional[typing.List[str]],
kwargs,
):
Create ImageSpec with the environment’s Python version and packages pinned to the ones in the environment.
Parameter | Type |
---|---|
pinned_packages |
typing.Optional[typing.List[str]] |
kwargs |
**kwargs |
image_name()
def image_name()
Full image name with tag.
is_container()
def is_container()
Check if the current container image in the pod is built from current image spec. :return: True if the current container image in the pod is built from current image spec, False otherwise.
with_apt_packages()
def with_apt_packages(
apt_packages: typing.Union[str, typing.List[str]],
):
Builder that returns a new image spec with an additional list of apt packages that will be executed during the building process.
Parameter | Type |
---|---|
apt_packages |
typing.Union[str, typing.List[str]] |
with_commands()
def with_commands(
commands: typing.Union[str, typing.List[str]],
):
Builder that returns a new image spec with an additional list of commands that will be executed during the building process.
Parameter | Type |
---|---|
commands |
typing.Union[str, typing.List[str]] |
with_copy()
def with_copy(
src: typing.Union[str, typing.List[str]],
):
Builder that returns a new image spec with the source files copied to the destination directory.
Parameter | Type |
---|---|
src |
typing.Union[str, typing.List[str]] |
with_packages()
def with_packages(
packages: typing.Union[str, typing.List[str]],
):
Builder that returns a new image speck with additional python packages that will be installed during the building process.
Parameter | Type |
---|---|
packages |
typing.Union[str, typing.List[str]] |
Properties
Property | Type | Description |
---|---|---|
tag |
flytekit.image_spec.image_spec.ImageSpecBuilder
Methods
Method | Description |
---|---|
build_image() |
Build the docker image and push it to the registry |
should_build() |
Whether or not the builder should build the ImageSpec |
build_image()
def build_image(
image_spec: flytekit.image_spec.image_spec.ImageSpec,
):
Build the docker image and push it to the registry.
Parameter | Type |
---|---|
image_spec |
flytekit.image_spec.image_spec.ImageSpec |
should_build()
def should_build(
image_spec: flytekit.image_spec.image_spec.ImageSpec,
):
Whether or not the builder should build the ImageSpec.
Parameter | Type |
---|---|
image_spec |
flytekit.image_spec.image_spec.ImageSpec |
flytekit.image_spec.image_spec.Version
This class abstracts handling of a project’s versions.
A :class:Version
instance is comparison aware and can be compared and
sorted using the standard Python interfaces.
v1 = Version(“1.0a5”) v2 = Version(“1.0”) v1 <Version(‘1.0a5’)> v2 <Version(‘1.0’)> v1 < v2 True v1 == v2 False v1 > v2 False v1 >= v2 False v1 <= v2 True
def Version(
version: str,
):
Initialize a Version object.
Parameter | Type |
---|---|
version |
str |
Properties
Property | Type | Description |
---|---|---|
base_version | ||
dev | ||
epoch | ||
is_devrelease | ||
is_postrelease | ||
is_prerelease | ||
local | ||
major | ||
micro | ||
minor | ||
post | ||
pre | ||
public | ||
release |
flytekit.image_spec.image_spec.cached_property
def cached_property(
func,
):
Parameter | Type |
---|---|
func |