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
title: A human readable name of this node
description: Detailed description of this node
pipeline: The pipeline this node belongs to
input_port_ids: tuple of all input port ids
output_port_ids: tuple of all output port ids
input: The default input port
output: The default output port
method: get_port
def get_port(self, id:str) -> Optional["Port"]
# each port has a unique id within the node.
# return a port given port id
# You can also use [] to get port by name
node["foo"] # same as node.get_port("foo")
method: on_message
on_message(self, port_id:str, data:Any)
Called when this node receives data. port_id is the id of the port which receive the data, data is the JSON payload of the data.
method: >> and <<
# You can use >>, << to connect nodes, here are examples:
nodeA >> nodeB # connect default output port of nodeA to default input port of node B
nodeA["foo"] >> nodeB # connect port "foo" of nodeA to default input port of node B
nodeA["foo"] >> nodeB["bar"] # connect port "foo" of nodeA to port "bar" of node B
# You can also use << as a reverse of >>
method: emit
def emit(self, data:Any, port_id:str=DEFAULT_OUTPUT_PORT_ID)
# emit data to it's output port specified by port_id