Skip to content
Edit this page

Pipeline

Pipelines transform one value through ordered stages. Builders are immutable: send, pipe, and through return a new builder. Stages run sequentially; use concurrency or parallel execution for independent jobs.

from titancore.pipeline import pipeline

result = pipeline(10).pipe(lambda value: value * 2).then_return()

Use then_return_async() when stages return awaitable values. The synchronous terminal methods reject awaitables. then(destination) and then_async(destination) pass the final value to a destination callback.

Class stages expose a handle method. Supply the application as the container argument to resolve their constructor dependencies. Registered stages use the existing container registration; unregistered stages use Container.call. StageMethod selects another stage method. ContinuationStage wraps a middleware callback that receives the next stage. Continuation stages can short-circuit execution or surround later stages.

The Pipeline facade supplies the current application automatically:

from titancore.facades import Pipeline

result = Pipeline.send(10).pipe(lambda value: value + 1).then_return()

Pipelines own no worker pool or resource lifecycle. Stage implementations own any resources they acquire. A pipeline used inside a process job must be constructed inside that process; application containers are not transferable.