ezmsg.baseproc.composite#
Composite processor classes for building pipelines.
Classes
- class CompositeProcessor(*args, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,MessageOutType],CompositeStateful[SettingsType,MessageOutType],ABC,Generic[SettingsType,MessageInType,MessageOutType]A processor that chains multiple processors together in a feedforward non-branching graph. The individual processors may be stateless or stateful. The last processor may be a consumer, otherwise processors must be transformers. Use
CompositeProducerif you want the first processor to be a producer. Concrete subclasses must implement_initialize_processors. Optionally override_reset_stateif you want adaptive state behaviour.Example implementation:
class CustomCompositeProcessor(CompositeProcessor[CustomSettings, AxisArray, AxisArray]): @staticmethod def _initialize_processors(settings: CustomSettings) -> dict[str, BaseProcessor]: return { "stateful_transformer": CustomStatefulProducer(**settings), "transformer": CustomTransformer(**settings), }
Where
**settingsshould be replaced with initialisation arguments for each processor.
- class CompositeProducer(*args, **kwargs)[source]#
Bases:
BaseProducer[SettingsType,MessageOutType],CompositeStateful[SettingsType,MessageOutType],ABC,Generic[SettingsType,MessageOutType]A producer that chains multiple processors (starting with a producer) together in a feedforward non-branching graph. The individual processors may be stateless or stateful. The first processor must be a producer, the last processor may be a consumer, otherwise processors must be transformers.
- class CompositeStateful[source]#
Bases:
Stateful[dict[str,Any]],ABC,Generic[SettingsType,MessageOutType]Mixin class for composite processor/producer chains. DO NOT use this class directly. Used to enforce statefulness of the composite processor/producer chain and provide initialization and validation methods.