flytekit.configuration.SerializationSettings#

class flytekit.configuration.SerializationSettings(image_config, project=None, domain=None, version=None, env=None, git_repo=None, python_interpreter='/opt/venv/bin/python3', flytekit_virtualenv_root=None, fast_serialization_settings=None, source_root=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.

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]

source_root#

The root directory of the source code.

Type

Optional[str]

Methods

static default_entrypoint_settings(interpreter_path)[source]#

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

Parameters

interpreter_path (str) –

Return type

flytekit.configuration.EntrypointSettings

classmethod for_image(image, version, project='', domain='', python_interpreter_path='/opt/venv/bin/python3')[source]#
Parameters
  • image (str) –

  • version (str) –

  • project (str) –

  • domain (str) –

  • python_interpreter_path (str) –

Return type

flytekit.configuration.SerializationSettings

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_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 from_transport(s)[source]#
Parameters

s (str) –

Return type

flytekit.configuration.SerializationSettings

new_builder()[source]#

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

Return type

Builder

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]

should_fast_serialize()[source]#

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

Return type

bool

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 venv_root_from_interpreter(interpreter_path)[source]#

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

Parameters

interpreter_path (str) –

Return type

str

with_serialized_context()[source]#

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. The setting will be available in the env field with the key SERIALIZED_CONTEXT_ENV_VAR :return: A newly constructed SerializationSettings, or self, if it already has the serializationSettings

Return type

flytekit.configuration.SerializationSettings

Attributes

dataclass_json_config = None
domain: Optional[str] = None
entrypoint_settings
env: Optional[Dict[str, str]] = None
fast_serialization_settings: Optional[flytekit.configuration.FastSerializationSettings] = None
flytekit_virtualenv_root: Optional[str] = None
git_repo: Optional[str] = None
project: Optional[str] = None
python_interpreter: str = '/opt/venv/bin/python3'
serialized_context

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

Type

return

source_root: Optional[str] = None
version: Optional[str] = None
image_config: flytekit.configuration.ImageConfig