itwinai.pipeline

This module provides the functionalities to execute workflows defined in in form of pipelines.

class itwinai.pipeline.Pipeline(steps: Dict[str, BaseComponent] | Iterable[BaseComponent], name: str | None = None)[source]

Bases: BaseComponent

Executes a set of components arranged as a pipeline.

Parameters:
steps: Dict[str, BaseComponent] | Iterable[BaseComponent]

Pipeline steps. Can be a list of BaseComponent or a dictionary allowing the user to name each BaseComponent.

execute(*args) Any[source]

Execute components sequentially.

static validate_args(input_args: Tuple, component: BaseComponent)[source]

Verify that the number of input args provided to some component match with the number of the non-default args in the component.

Parameters:
  • input_args (Tuple) – input args to be fed to the component.

  • component (BaseComponent) – component to be executed.

Raises:

RuntimeError – in case of args mismatch.