flytekit.extend.SerializationSettings

class flytekit.extend.SerializationSettings(image_config, project=None, domain=None, version=None, env=None, python_interpreter='/opt/venv/bin/python3', flytekit_virtualenv_root=None, fast_serialization_settings=None)[source]

These settings are provided while serializing a workflow and task, before registration. This is required to get runtime information at serialization time, as well as some defaults.

TODO: ImageConfig, python_interpreter, venv_root, fast_serialization_settings.destination_dir should be combined.

Parameters
Return type

None

project

The project (if any) with which to register entities under.

Type

str

domain

The domain (if any) with which to register entities under.

Type

str

version

The version (if any) with which to register entities under.

Type

str

image_config

The image config used to define task container images.

Type

ImageConfig

env

Environment variables injected into task container definitions.

Type

Optional[Dict[str, str]]

flytekit_virtualenv_root

During out of container serialize the absolute path of the flytekit virtualenv at serialization time won’t match the in-container value at execution time. This optional value is used to provide the in-container virtualenv path

Type

Optional[str]

python_interpreter

The python executable to use. This is used for spark tasks in out of container execution.

Type

Optional[str]

entrypoint_settings

Information about the command, path and version of the entrypoint program.

Type

Optional[EntrypointSettings]

fast_serialization_settings

If the code is being serialized so that it can be fast registered (and thus omit building a Docker image) this object contains additional parameters for serialization.

Type

Optional[FastSerializationSettings]

__init__(image_config, project=None, domain=None, version=None, env=None, python_interpreter='/opt/venv/bin/python3', flytekit_virtualenv_root=None, fast_serialization_settings=None)
Parameters
Return type

None

Methods

__init__(image_config[, project, domain, ...])

default_entrypoint_settings(interpreter_path)

Assumes the entrypoint is installed in a virtual-environment where the interpreter is

for_image(image, version[, project, domain, ...])

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

from_transport(s)

new_builder()

Creates a SerializationSettings.Builder that copies the existing serialization settings parameters and allows for customization.

schema(*[, infer_missing, only, exclude, ...])

should_fast_serialize()

Whether or not the serialization settings specify that entities should be serialized for fast registration.

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

venv_root_from_interpreter(interpreter_path)

Computes the path of the virtual environment root, based on the passed in python interpreter path for example /opt/venv/bin/python3 -> /opt/venv

with_serialized_context()

Use this method to create a new SerializationSettings that has an environment variable set with the SerializedContext This is useful in transporting SerializedContext to serialized and registered tasks.

Attributes

domain

entrypoint_settings

env

fast_serialization_settings

flytekit_virtualenv_root

project

python_interpreter

serialized_context

returns the serialization context as a base64encoded, gzip compressed, json strinnn

version

image_config