Compiler

Compile a Kale Pipeline into a Kubeflow Pipelines v2 DSL script.

This module renders the Jinja2 templates in kale/templates/ to produce a ready-to-run KFP v2 pipeline script, formats it, and optionally hands it off to the KFP SDK for compilation and submission.

class kale.compiler.Artifact(name: str, type: str, is_input: bool = False)[source]

Bases: NamedTuple

A Step artifact.

name: str

Alias for field number 0

type: str

Alias for field number 1

is_input: bool

Alias for field number 2

class kale.compiler.Compiler(pipeline: Pipeline, imports_and_functions: str)[source]

Bases: object

Converts a Pipeline object into a KFP executable.

Compiler provides the tools to convert a Pipeline object into an executable script that uses the KFP DSL to create and upload a new pipeline.

The Pipeline object is assumed to provide all the necessary information (environment, configuration, etc…) for the script to be compiled.

compile_and_run()[source]

First compile the Pipeline to DSL and then run it.

compile()[source]

Convert Pipeline to KFP DSL.

Returns path to DSL script.

run()[source]

Run the generated KFP script.

generate_dsl()[source]

Generate a Python KFP DSL executable starting from the pipeline.

Returns (str): A Python executable script

generate_lightweight_component(step: Step)[source]

Generate Python code using the notebook function template.

generate_pipeline(lightweight_components)[source]

Generate Python code using the pipeline template.