Skip to main content

SerializationContext

This object holds serialization time contextual information, that can be used when serializing the task and various parameters of a tasktemplate. This is only available when the task is being serialized and can be during a deployment or runtime.

Attributes

AttributeTypeDescription
versionstrThe version of the task
project`strNone`
domain`strNone`
org`strNone`
code_bundleOptional[[CodeBundle](codebundle.md?sid=flyte_models_codebundle)]The code bundle for the task. This is used to package the code and the inflation path.
input_pathstr = {{.input}}The path to the inputs for the task. This is used to determine where the inputs will be located
output_pathstr = {{.outputPrefix}}The path to the outputs for the task. This is used to determine where the outputs will be located
interpreter_pathstr = /opt/venv/bin/pythonThe file path to the Python interpreter used for task execution and entrypoint resolution.
image_cache`ImageCacheNone`
root_dirOptional[pathlib.Path]The root directory path on the local filesystem for serialization operations.

Constructor

Signature

def SerializationContext(
version: str,
code_bundle: Optional[[CodeBundle](codebundle.md?sid=flyte_models_codebundle)] = None,
input_path: str = "{{.input}}",
output_path: str = "{{.outputPrefix}}",
project: str | None = None,
domain: str | None = None,
org: str | None = None,
interpreter_path: str = "/opt/venv/bin/python",
image_cache: ImageCache | None = None,
root_dir: Optional[pathlib.Path] = None
) - > null

Parameters

NameTypeDescription
versionstrThe version of the task
code_bundleOptional[[CodeBundle](codebundle.md?sid=flyte_models_codebundle)] = NoneThe code bundle for the task used for packaging and inflation
input_pathstr = "{{.input}}"The path where task inputs are located
output_pathstr = "{{.outputPrefix}}"The path where task outputs will be stored
project`strNone` = None
domain`strNone` = None
org`strNone` = None
interpreter_pathstr = "/opt/venv/bin/python"The path to the python interpreter
image_cache`ImageCacheNone` = None
root_dirOptional[pathlib.Path] = NoneThe root directory for the serialization context

Methods


get_entrypoint_path()

@classmethod
def get_entrypoint_path(
interpreter_path: Optional[str] = None
) - > str

Get the entrypoint path for the task. This is used to determine the entrypoint for the task execution.

Parameters

NameTypeDescription
interpreter_pathOptional[str] = NoneThe file path to the Python interpreter; if not provided, the context's default interpreter path is used.

Returns

TypeDescription
strThe absolute file path to the 'runtime.py' script located in the same directory as the provided or default interpreter.