Step¶
Pipeline step data model.
Defines Step, the unit of execution inside a Kale Pipeline,
together with StepConfig and the PipelineParam / Artifact
named tuples used to describe step inputs and outputs.
- class kale.step.PipelineParam(param_type: str, param_value: Any)[source]¶
Bases:
NamedTupleA pipeline parameter.
- class kale.step.Artifact(name: str, type: str, is_input: bool = False)[source]¶
Bases:
NamedTupleA Step artifact.
- class kale.step.StepConfig(*args, **kwargs)[source]¶
Bases:
ConfigConfig class used for the Step object.
- name = <kale.config.config.Field object>¶
- labels = <kale.config.config.Field object>¶
- annotations = <kale.config.config.Field object>¶
- limits = <kale.config.config.Field object>¶
- base_image = <kale.config.config.Field object>¶
- enable_caching = <kale.config.config.Field object>¶
- retry_count = <kale.config.config.Field object>¶
- retry_interval = <kale.config.config.Field object>¶
- retry_factor = <kale.config.config.Field object>¶
- retry_max_interval = <kale.config.config.Field object>¶
- timeout = <kale.config.config.Field object>¶
- class kale.step.Step(source: list[str] | Callable, ins: list[Any] = None, outs: list[Any] = None, **kwargs)[source]¶
Bases:
objectClass used to store information about a Step of the pipeline.
- parameters: dict[str, PipelineParam]¶
- add_artifact(artifact_name, artifact_type, is_input)[source]¶
Helper method to add an artifact to the step.
Artifact_type will be either ‘Dataset’, ‘Model’, ‘HTML’, ‘Metrics’, ‘ClassificationMetrics’ or ‘Artifact’. This will simplify tracking what should be an Input[Artifact] or Output[Artifact].
- run(pipeline_parameters_values: dict[str, PipelineParam])[source]¶
Run the step locally.
- property name¶
Get the name of the step.
- merge_code(source_code: str)[source]¶
Add a new code block to the step.
- Parameters:
source_code (str) – Python source code to be appended to step
- property pps_names¶
Get the names of the step’s parameters sorted.
- property pps_types¶
Get the types of the step’s parameters, sorted by name.
- property pps_values¶
Get the values of the step’s parameters, sorted by name.
- property rendered_source¶
Source to be rendered in the template.
- property kfp_inputs: list[PipelineParam | Artifact]¶
Get the inputs of the step for KFP.
This combines PipelineParams and Artifacts marked as inputs. Add PipelineParams first (as they’re usually positional/keyword args)