runner

Pipeline runner for managing pipeline task execution.

This module provides the PipelineRunner class that handles the execution of pipeline tasks with signal handling, garbage collection, and lifecycle management.

class pipecat.pipeline.runner.PipelineRunner(*, name: str | None = None, handle_sigint: bool = True, handle_sigterm: bool = False, force_gc: bool = False, loop: AbstractEventLoop | None = None)[source]

Bases: BaseObject

Manages the execution of pipeline tasks with lifecycle and signal handling.

Provides a high-level interface for running pipeline tasks with automatic signal handling (SIGINT/SIGTERM), optional garbage collection, and proper cleanup of resources.

__init__(*, name: str | None = None, handle_sigint: bool = True, handle_sigterm: bool = False, force_gc: bool = False, loop: AbstractEventLoop | None = None)[source]

Initialize the pipeline runner.

Parameters:
  • name – Optional name for the runner instance.

  • handle_sigint – Whether to automatically handle SIGINT signals.

  • handle_sigterm – Whether to automatically handle SIGTERM signals.

  • force_gc – Whether to force garbage collection after task completion.

  • loop – Event loop to use. If None, uses the current running loop.

async run(task: PipelineTask)[source]

Run a pipeline task to completion.

Parameters:

task – The pipeline task to execute.

async stop_when_done()[source]

Schedule all running tasks to stop when their current processing is complete.

async cancel()[source]

Cancel all running tasks immediately.