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
| Attribute | Type | Description |
|---|---|---|
| version | str | The version of the task |
| project | `str | None` |
| domain | `str | None` |
| org | `str | None` |
| code_bundle | Optional[[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_path | str = {{.input}} | The path to the inputs for the task. This is used to determine where the inputs will be located |
| output_path | str = {{.outputPrefix}} | The path to the outputs for the task. This is used to determine where the outputs will be located |
| interpreter_path | str = /opt/venv/bin/python | The file path to the Python interpreter used for task execution and entrypoint resolution. |
| image_cache | `ImageCache | None` |
| root_dir | Optional[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
| Name | Type | Description |
|---|---|---|
| version | str | The version of the task |
| code_bundle | Optional[[CodeBundle](codebundle.md?sid=flyte_models_codebundle)] = None | The code bundle for the task used for packaging and inflation |
| input_path | str = "{{.input}}" | The path where task inputs are located |
| output_path | str = "{{.outputPrefix}}" | The path where task outputs will be stored |
| project | `str | None` = None |
| domain | `str | None` = None |
| org | `str | None` = None |
| interpreter_path | str = "/opt/venv/bin/python" | The path to the python interpreter |
| image_cache | `ImageCache | None` = None |
| root_dir | Optional[pathlib.Path] = None | The 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
| Name | Type | Description |
|---|---|---|
| interpreter_path | Optional[str] = None | The file path to the Python interpreter; if not provided, the context's default interpreter path is used. |
Returns
| Type | Description |
|---|---|
str | The absolute file path to the 'runtime.py' script located in the same directory as the provided or default interpreter. |