map¶
- pydantic model Map[source]¶
Cardinality expansion
Given a node that emits 1 (iterable) event, split it into separate events.
`{admonition} Implementation Note Map is a *special node* - it is the only node where returning a list of values is interpreted as multiple events. For all other nodes, returning a list of values is interpreted as a single event with a list value. To return multiple events from a single node, chain a `map` after it. `- Config:
extra: str = forbid
- Fields:
- field stateful: bool = False¶
Whether this node is stateful (True), or stateless (False). Stateful nodes are assumed to care about the order in which they receive events - i.e. for a given set of inputs, the values returned by
processare different when called in a different order.This attribute has no effect in synchronous runners, but in concurrent runners where multiple epochs of events can be processed simultaneously, setting a node as stateless can improve performance as the node processes events as soon as it receives them rather than waiting for the next epoch in the sequence to arrive.
Defined as an instance, rather than a class attribute to allow it being overridden by a node specification. Subclasses should override the default value to be considered stateless by default.
By default, unless specified otherwise:
Class nodes are considered stateful
Generator nodes are considered stateful
Function nodes are considered stateless