ezmsg.baseproc.stateful#
Stateful processor base classes for ezmsg.
Classes
- class BaseAdaptiveTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[SettingsType,MessageInType,MessageOutType|None,StateType],ABC,Generic[SettingsType,MessageInType,MessageOutType,StateType]
- class BaseAsyncTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[SettingsType,MessageInType,MessageOutType,StateType],ABC,Generic[SettingsType,MessageInType,MessageOutType,StateType]This reverses the priority of async and sync methods from
BaseStatefulTransformer. Whereas inBaseStatefulTransformer, the async methods simply called the sync methods, here the sync methods call the async methods, more similar toBaseStatefulProducer.
- class BaseStatefulConsumer(*args, **kwargs)[source]#
Bases:
BaseStatefulProcessor[SettingsType,MessageInType,None,StateType],ABC,Generic[SettingsType,MessageInType,StateType]Base class for stateful message consumers that don’t produce output. This class merely overrides the type annotations of BaseStatefulProcessor.
- class BaseStatefulProcessor(*args, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,MessageOutType],Stateful[StateType],ABC,Generic[SettingsType,MessageInType,MessageOutType,StateType]Base class implementing common stateful processor functionality. You probably do not want to inherit from this class directly. Refer instead to the more specific base classes. Use BaseStatefulConsumer for operations that do not return a result, or BaseStatefulTransformer for operations that do return a result.
- class BaseStatefulProducer(*args, **kwargs)[source]#
Bases:
BaseProducer[SettingsType,MessageOutType],Stateful[StateType],ABC,Generic[SettingsType,MessageOutType,StateType]- Base class implementing common stateful producer functionality.
Examples of stateful producers are things that require counters, clocks, or to cycle through a set of values.
- Unlike BaseStatefulProcessor, this class does not message hashing because there
are no input messages. We still use self._hash to simply track the transition from initialization (.hash == -1) to state reset (.hash == 0).
- class BaseStatefulTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulProcessor[SettingsType,MessageInType,MessageOutType,StateType],ABC,Generic[SettingsType,MessageInType,MessageOutType,StateType]Base class for stateful message transformers that produce output. This class merely overrides the type annotations of BaseStatefulProcessor.
- class Stateful[source]#
Bases:
ABC,Generic[StateType]Mixin class for stateful processors. DO NOT use this class directly. Used to enforce that the processor/producer has a state attribute and stateful_op method.
- STREAMING_DIMS: ClassVar[tuple[str, ...]] = ('time',)#
Fallback stream dimension for messages that do not declare one.
Consulted only when
stream_dimisNone.("time",)is right for a raw signal and wrong downstream of a windowing stage, where the message is(win, time, ch)andwinis what grows; such a processor sets("win",).Prefer teaching the producer to declare
stream_dim. That puts the answer in the one place that knows it, rather than asking each consumer to guess about a message it did not create.
- property state: StateType#