You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Casey Ching <ca...@eazeup.com> on 2016/10/31 22:24:05 UTC

Callback on DAG failure?

Hello,

I’d like the ability to send notifications when a DAG fails. Basically the
same as on_failure_callback that is available for operators but for a DAG
instead. Is there a way to do that now?

Thanks,
Casey

Re: Callback on DAG failure?

Posted by Casey Ching <ca...@eazeup.com>.
Thanks for the info. I’ll look into sending a PR for the callback option.

Casey

On October 31, 2016 at 3:38:37 PM, siddharth anand (sanand@apache.org) wrote:

*Today*  
You would need to add 2 new tasks in a chain to the end of your current  
dag, your_dag --> ShortCircuitOperator --> PythonOperator. The  
ShortCircuitOperator will need to specify a trigger rule of *all_done *to  
ensure it's always called. Then, specify a python callable that checks the  
status of upstream tasks for success. If all direct upstream tasks are  
successful, skip the last task. If not, then execute the last task which  
would carry out the failure notification that you desire.  

*Future*  
Implement an on-failure callback. Have a look at how dag.sla_miss_callback is  
implemented!  

-s  

On Mon, Oct 31, 2016 at 3:24 PM, Casey Ching <ca...@eazeup.com> wrote:  

> Hello,  
>  
> I’d like the ability to send notifications when a DAG fails. Basically the  
> same as on_failure_callback that is available for operators but for a DAG  
> instead. Is there a way to do that now?  
>  
> Thanks,  
> Casey  
>  

Re: Callback on DAG failure?

Posted by siddharth anand <sa...@apache.org>.
*Today*
You would need to add 2 new tasks in a chain to the end of your current
dag, your_dag --> ShortCircuitOperator --> PythonOperator. The
ShortCircuitOperator will need to specify a trigger rule of *all_done *to
ensure it's always called. Then, specify a python callable that checks the
status of upstream tasks for success. If all direct upstream tasks are
successful, skip the last task. If not, then execute the last task which
would carry out the failure notification that you desire.

*Future*
Implement an on-failure callback. Have a look at how dag.sla_miss_callback is
implemented!

-s

On Mon, Oct 31, 2016 at 3:24 PM, Casey Ching <ca...@eazeup.com> wrote:

> Hello,
>
> I’d like the ability to send notifications when a DAG fails. Basically the
> same as on_failure_callback that is available for operators but for a DAG
> instead. Is there a way to do that now?
>
> Thanks,
> Casey
>