I want to call two different functions for dag failure and success. For that i want to use on_failure_callback and on_success_callback in DAG() function.
As per my requirement, this callbacks should be on dag level and not task level. That's why i am writing this callbacks insiled DAG() functions while declaring dag variable.
but this callback function are not being called. Same function if i call on task level , then working fine.
This is my code:
def success():
print("successful")
dag = DAG(dag_id='callback_test',schedule_interval=None,default_args=default_args,on_success_callback=success)
def fun1(**kwargs):
print("function called")
task1 = PythonOperator(
task_id='task1',
provide_context=True,
python_callable=fun1,
dag=dag
)
task1
question from:
https://stackoverflow.com/questions/65934476/on-failure-callback-not-working-in-airflow-dag 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…