Skip to main content

set_logger

logging.Logger
required
Sets a logger for this DAG. Throws error if not a valid logger.

is_node

Node
required
The node to check.
bool
Returns boolean indicating whether the node is a Node.

add_node

Node
required
The node to set as the root. Adds to nodes if not added already. Throws error if not a valid node.

remove_node

Node
required
The node to remove. Throws errors if not a valid node or if the node is not in the graph.

get_node

str
required
The node id to get. Throws error if not a valid id or if node not in graph.

add_edge

Node
required
The node to add the edge from. Throws error if not a valid node or if node not in graph.
Node
required
The node to add the edge to. Throws error if not a valid node, if node not in graph, or if there’s a cycle.
Callable[[dict[str:type]], dict[str:type]]
A function to transform the outputs of from_node for to_node. Defaults to lambda x: x.

remove_edge

Node
required
The node to add the edge from. Throws error if not a valid node or if node not in graph.
Node
required
The node to add the edge to. Throws error if not a valid node, if node not in graph, or if there’s a cycle.

execute

Topologically sorts the graph and runs it.
dict[str:type]
required
A dictionary of node_id keys -> its initial args and kwargs, which will be set to execute_args once the DAG runs.