Chain
- class ioiocore.chain.Chain(**kwargs)[source]
Bases:
ProcessingElementBase class for all chain types.
A chain is a processing element that contains a sequence of internal nodes connected together. Chains expose ports from their boundary nodes (first and/or last) to the outside world.
Subclasses: - IChain: Input chain (exposes input ports from first node) - OChain: Output chain (exposes output ports from last node) - IOChain: Input/Output chain (exposes both)
Inheriting classes must implement: - create_internal_nodes(): Returns the list of internal nodes
- class Configuration(name=None, **kwargs)[source]
Bases:
ConfigurationConfiguration class for Chain.
- Parameters:
name (str)
- INTERNALS_ARE_DERIVED: bool = True
Whether the internal nodes are derived from this chain’s configuration rather than being state of their own.
When True – the default –
serialize()omits them and a loader rebuilds them withcreate_internal_nodes(). That is the honest description of a chain whose composition is a function of its configuration, and it is the only arrangement that lets the loading process decide the composition.Why that matters: a chain may legitimately build itself differently depending on where it is running. A consuming package that splits one pipeline across two hosts builds an acquisition node on the host that has the device and a network bridge on the host that does not. Embedding the internals defeats it exactly: the receiving side restores the sender’s composition and rebuilds the sender’s half, so the two ends are copies rather than complements.
Set it False on a chain whose internals cannot be rebuilt from configuration alone – one whose
create_internal_nodesis not a function ofconfig. Then the internals travel, and the loading process’s own view is overridden, which is the trade.
- config: Configuration
- abstractmethod create_internal_nodes()[source]
Create and return the list of internal nodes.
- Returns:
List of internal nodes forming the processing chain.
- Return type:
List[Node]
- serialize()[source]
Serialize the chain.
The internal nodes are included only when this chain declares that they are not derived from its configuration – see
INTERNALS_ARE_DERIVED. Omitting them is what lets the loading process build the composition it needs rather than replaying the writer’s.- Returns:
The serialized chain.
- Return type:
dict