graphviper.graph_tools.generate_airflow_workflow
Functions
|
Generate an Airflow DAG Python source file from a viper map/reduce graph. |
Convert an Airflow DAG to a graphviz Digraph object. |
Module Contents
- generate_airflow_workflow(viper_graph, dag_id='0', schedule_interval=None, filename='airflow_dag_test.py', dag_name='map_reduce')[source]
Generate an Airflow DAG Python source file from a viper map/reduce graph.
Deprecated since version The: Airflow backend is deprecated and will be removed in a future release. Use
graphviper.graph_tools.generate_dask_workflow.generate_dask_workflow()orgraphviper.graph_tools.process_with_mpi.processes_with_mpi()instead.The map node task (and, if present, the reduce node task) are extracted with
inspect.getsource()and written into a standalone Airflow DAG module atfilename. Onlymode="single_node"reduce graphs are supported.- Parameters:
viper_graph (Dict) – Graph produced by
graphviper.graph_tools.map.map()(and optionallygraphviper.graph_tools.reduce.reduce()).dag_id (str, optional) – Currently unused; retained for API compatibility, by default
"0".schedule_interval (optional) – Currently unused; retained for API compatibility, by default None.
filename (str, optional) – Path of the Airflow DAG Python file to write, by default
"airflow_dag_test.py".dag_name (str, optional) – Name of the generated
@dagfunction, by default"map_reduce".
- Returns:
The function writes the generated DAG source to
filenameas a side effect and returns nothing.- Return type:
None
- Raises:
AssertionError – If a reduce stage is present with a
modeother than"single_node".
- airflow_dag_to_graphviz(dag)[source]
Convert an Airflow DAG to a graphviz Digraph object.
Deprecated since version The: Airflow backend is deprecated and will be removed in a future release.
- Parameters:
dag (airflow.models.DAG) – The Airflow DAG object.
- Returns:
A
graphviz.Digraphobject representing the DAG.- Return type:
graphviz.Digraph