towhee.functional.mixins.dag.DagMixin

class towhee.functional.mixins.dag.DagMixin[source]

Bases: object

Mixin for creating DAGs and their corresponding yamls from a DC.

Methods

compile_dag

Compile the dag.

netx

Show dags' relations.

notify_consumed

Notfify that a DataCollection was consumed.

register_dag

Function that can be called within the function trying to be added to dag.

Attributes

control_plane

__init__() None[source]
compile_dag()[source]

Compile the dag.

Runs a schema of commands that removes unecessary steps and cleans the DAG.

Returns:

The compiled DAG.

Return type:

dict

netx()[source]

Show dags’ relations.

Returns:

The dags’ relations

Return type:

image

notify_consumed(new_id)[source]

Notfify that a DataCollection was consumed.

When a DataCollection is consumed by a call to another DataCollection, that Dag needs to be aware of this, so any functions that consume more than the DataCollection calling the function need to use this function, e.g. zip().

Parameters:

new_id (str) – The ID of the DataCollection that did the consuming.

register_dag(children)[source]

Function that can be called within the function trying to be added to dag.

Parameters:

children (DataCollecton or list) – List of children DataCollection’s or singular child DataCollection.

Returns:

The resulting child DataCollections.

Return type:

DataCollection or list