# Introducing Azflow¶

Azflow is a simple tool inspired by Airflow which makes it easier to write workflows for Azkaban. Workflows are collections of sequenced tasks that are used by data engineers to extract, transform, and load data.

Azkaban offers many standard features of a workflow management tool: GUI, scheduling, retries, alerting, logging, etc. However, its method of programming workflows is a little bit cumbersome. Each task is defined in its own .job file containing a list of other tasks it depends on. Creating these manually works well for small workflows, but becomes unwieldy when working with hundreds or thousands of tasks.

Azflow is one of several tools which try to address this issue, including LinkedIn Gradle DSL for Apache Hadoop, AzkabanCLI, and azkaban-rb. While these tools create their own abstractions, Azflow is based on the model created by Airflow. Workflows are defined in Python code as Task objects which form a DAG (directed acyclic graph) object. For simple workflows this is only sightly more compact than Azkaban's native format, but this model is much more powerful when applied to complex jobs.

For example, if you have many similar tasks with slightly different parameters you can maintain these as a list and loop through it to generate as many tasks as are needed. This minimizes the number of source code files to maintain and follows the principle of D.R.Y.

Example_dag_loop.py demonstrates this concept:

In [1]:
from azflow.DAG import DAG
from azflow.BashOperator import BashOperator

loop_dag = DAG(dag_id='loop_dag')

bash_command='echo "begin"')

bash_command='echo "clean up"')

tasks_to_loop = ['do', 'all', 'these', 'in', 'no','particular', 'order']
bash_command='echo "start {}"'.format(t))

bash_command='echo "finish {}"'.format(t))

python -m azflow.render --dag_file example/example_dag_loop.py --output_folder example/example_flow_loop/