def sub_dag(parent_dag_name, child_dag_name, start_date, schedule_interval,
    value):
    dag = DAG('%s.%s' % (parent_dag_name, child_dag_name),
        schedule_interval=schedule_interval, start_date=start_date)
for x in range(value):
    bash_cmd = 'echo B{}'.format(x)
task_operator = BashOperator(bash_command=bash_cmd, task_id='B*{}'.format(x
    ), dag=dag)
return dag
Proper way to create dynamic workflows in Airflow