Skip to content

execution_strategy

execution_strategy

Execution strategy abstraction for different execution modes.

Implements Strategy pattern to support sync, async, and streaming execution without modifying core pipeline logic.

ExecutionStrategy

Bases: ABC

Abstract base for execution strategies.

Follows Strategy pattern: defines interface for executing pipeline stages in different modes (sync, async, streaming).

name abstractmethod property

name: str

Strategy name for logging.

execute abstractmethod

execute(stages: list[PipelineStage], context: ExecutionContext) -> ExecutionResult | Iterator[pd.DataFrame] | AsyncIterator[pd.DataFrame]

Execute pipeline stages.

Parameters:

Name Type Description Default
stages list[PipelineStage]

List of pipeline stages to execute

required
context ExecutionContext

Execution context for state management

required

Returns:

Type Description
ExecutionResult | Iterator[DataFrame] | AsyncIterator[DataFrame]

ExecutionResult or iterator for streaming

Source code in ondine/orchestration/execution_strategy.py
@abstractmethod
def execute(
    self,
    stages: list[PipelineStage],
    context: ExecutionContext,
) -> ExecutionResult | Iterator[pd.DataFrame] | AsyncIterator[pd.DataFrame]:
    """
    Execute pipeline stages.

    Args:
        stages: List of pipeline stages to execute
        context: Execution context for state management

    Returns:
        ExecutionResult or iterator for streaming
    """
    pass

supports_async abstractmethod

supports_async() -> bool

Whether this strategy supports async execution.

Source code in ondine/orchestration/execution_strategy.py
@abstractmethod
def supports_async(self) -> bool:
    """Whether this strategy supports async execution."""
    pass

supports_streaming abstractmethod

supports_streaming() -> bool

Whether this strategy supports streaming.

Source code in ondine/orchestration/execution_strategy.py
@abstractmethod
def supports_streaming(self) -> bool:
    """Whether this strategy supports streaming."""
    pass