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_typestrThe data_type to publish downstream.
method__call__(input_data, job_parameters) -> TOutputTransform input data into a typed result.
paraminput_dataTInputInput 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
TOutputTyped result (Pydantic BaseModel).
Raises:
Exception: Exceptions of the processor. A worker that calls the processor maps them to SoftFailureException / HardFailureException.