Pipeline

class ioiocore.pipeline.Pipeline(directory=None)[source]

Bases: Interface

A class representing a pipeline, inheriting from Interface. Manages nodes and their connections within the pipeline.

Parameters:

directory (str)

__init__(directory=None)[source]

Initializes the pipeline.

Parameters:

directory (str, optional) – Directory to be used for the pipeline (default is None).

add_node(node)[source]

Adds a node to the pipeline.

Parameters:

node (Node) – The node to add to the pipeline.

connect(output_node, input_node)[source]

Connects output and input nodes in the pipeline.

Parameters:
  • output_node (ONode) – The node providing the output.

  • input_node (INode) – The node receiving the input.

connect_ports(output_node, output_node_port, input_node, input_node_port)[source]

Connects output and input ports of nodes in the pipeline.

Parameters:
  • output_node (ONode) – The node providing the output port.

  • output_node_port (str) – The name of the output port.

  • input_node (INode) – The node receiving the input port.

  • input_node_port (str) – The name of the input port.

static deserialize(data)[source]

Deserializes the pipeline from a dictionary.

Parameters:

data (dict) – A dictionary containing the serialized pipeline data.

Returns:

The deserialized pipeline object.

Return type:

Pipeline

disconnect(output_node, input_node)[source]

Disconnects output and input nodes in the pipeline.

Parameters:
  • output_node (ONode) – The node providing the output.

  • input_node (INode) – The node receiving the input.

disconnect_ports(output_node, output_node_port, input_node, input_node_port)[source]

Disconnects output and input ports of nodes in the pipeline.

Parameters:
  • output_node (ONode) – The node providing the output port.

  • output_node_port (str) – The name of the output port.

  • input_node (INode) – The node receiving the input port.

  • input_node_port (str) – The name of the input port.

get_condition()[source]

Returns the current condition of the pipeline.

Returns:

The current condition of the pipeline.

Return type:

Constants.Conditions

get_elapsed_time()[source]

Returns the elapsed time since the pipeline started.

Returns:

The elapsed time in seconds.

Return type:

float

get_last_error()[source]

Returns the last error message from the pipeline.

Returns:

The last error message.

Return type:

str

get_load()[source]

Returns the current load of the pipeline.

Returns:

The current load as a percentage.

Return type:

float

get_state()[source]

Returns the current state of the pipeline.

Returns:

The current state of the pipeline.

Return type:

Constants.States

remove_node(node)[source]

Removes a node from the pipeline.

Parameters:

node (Node) – The node to remove from the pipeline.

serialize()[source]

Serializes the pipeline to a dictionary.

Returns:

A dictionary representing the serialized pipeline.

Return type:

dict

start()[source]

Starts the pipeline.

stop()[source]

Stops the pipeline.

write_log(entry)[source]

Writes a log entry to the pipeline.

Parameters:

entry (str) – The log entry to write.