Represent a node in the pipeline. A node can have bunch of input ports and bunch of output ports. Each port has a unique id within the node.
Properties:
- id: the id of the node, it is unique within a pipeline
- input: the default input port, e.g. node.input
- output: the default input port, e.g. node.output
- input_port_ids: tuple of all input port ids
- output_port_ids: tuple of all output port ids
Methods:
def get_port(self, id:str) -> Optional["Port"]
# return a port given id
on_message(self, name:str, data:Any)
This method will be called for this node to handle data point, data is a json object, name represent from which port the data is received.
def connect(self, *dest_ports:Union["Node", "Port"]) -> "Port"
# connect the default output port to a input port of a node
# if dest_port element is a Node, then the default input port is used
def emit(self, data:Any, name:str=DEFAULT_PORT_NAME)
# emit data to it's output port specified by name