soev for developers
WarrenReference

warren.processors

Framework processor protocol.

Protocols

Processor

protocolProcessor[TInput, TOutput]

Generic protocol for a processing strategy.

Processors are synchronous callables that transform TInput to TOutput. They declare what input types they support and what output type they produce for downstream routing.

A convention for application workers: a worker can keep a dispatch table from supported_types and call the processor in an executor. Warren's worker base classes do not use this protocol.

Sync by design — processors are reusable outside the distributed system (e.g., in scripts, notebooks, tests). The worker handles async concerns (run_in_executor, store I/O).

Result types are Pydantic BaseModels, so a worker can call model_dump() for storage and model_validate() for reconstruction.

attributesupported_typesfrozenset[str]

Format/data types this processor handles.

A worker can use them to build its dispatch table.

attributeoutput_typestr

The data_type to publish downstream.

method__call__(input_data, job_parameters) -> TOutput

Transform input data into a typed result.

paraminput_dataTInput

Input data (bytes, API response, etc.).

paramjob_parametersdict[str, Any]

Per-job configuration from the message. Processor extracts what it needs via .get() with defaults.

Returns

TOutput

Typed result (Pydantic BaseModel).

Raises:

  • Exception: Exceptions of the processor. A worker that calls the processor maps them to SoftFailureException / HardFailureException.

On this page