API reference¶
-
class
fluteline.Node¶ An abstract base class for producers, consumers, or consumer-producers in a pipeline.
- Hooks
- Setup resources when starting in
enterand clean after yourself inexit. - Outputting values
- Send messages to the next node in the pipeline with
self.put(new_value). - Connect, start, and stop
- First, connect the node to a destination with
connect(other_node), then callstart. Don’t forget to callstop. Otherwise the thread will stay alive.
-
connect(other_node)¶ Connect the output of this node to
other_node’s input.
-
consume(msg)¶ Override if your node should react to incoming message, whether it’s a consumer, consumer-producer, or just a producer.
Parameters: msg – An incoming messages to process.
-
enter()¶ Override to prepare resources.
-
exit()¶ Override to cleanup after yourself.
-
put(msg)¶ Send a message to the next node in the pipeline.
-
stop()¶ Stop the node gracefully.
-
class
fluteline.Producer¶ Inherit this class to create a producer.
-
produce()¶ Override to produce new messages.
-
-
class
fluteline.Consumer¶ Inherit this class to create a consumer or consumer-producer.
Utilities¶
-
class
fluteline.Logger(logger=None)¶ A utility consumer-producer that logs messages.
Parameters: logger – Provide your own logger or get a new flutelinelogger. Logging level islogging.INFO.
-
fluteline.connect(nodes)¶ Connect a list of nodes.
-
fluteline.start(nodes)¶ Start multiple nodes.
-
fluteline.stop(nodes)¶ Stop multiple nodes.