I'll take a stab at it and hopefully you can adapt your code to work with this.
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2015, 6, 1),
'email': ['[email protected]'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
# 'queue': 'bash_queue',
# 'pool': 'backfill',
# 'priority_weight': 10,
# 'end_date': datetime(2016, 1, 1),
}
dag = DAG('your_dag', default_args=default_args)
#start of your tasks
first_task = BashOperator(task_id='print_date',
bash_command='python script1_name args',
dag=dag)
second_task = BashOperator(task_id='print_date',
bash_command='python script2_name args',
dag=dag)
third_task = BashOperator(task_id='print_date',
bash_command='python script_name args',
dag=dag)
#then set the dependencies
second_task.set_upstream(first_task)
third_task.set_upstream(second_task)
Then when you trigger the DAG, all three tasks will run in order. If these tasks are not dependent on each other, you can remove the set_upstream()
lines from the script. Note that all of these tasks must be in the same script to run with one command.
airflow trigger_dag id
what is the issue? – Daniel Leeairflow schedule
in a separate thread (next to web server). Then you'll be able to manually trigger DAG – Khozzy