title: Airflow, on failure, make all dags do something in specific
body: <p>We have a lot of DAGs running on Airflow. When something fails, we want to be notified, or make a specific action: I have tried via decorator </p>
  
  <pre><code>def on_failure_callback(f):
    @wraps(f)
    def wrap(*args, **kwargs):
      try:
        return f(*args, **kwargs)
      except Exception as e:
        return f"An exception {e} on ocurred on{f}" 
    return wrap
  </code></pre>
  
  <p>This works, but it is necessary to decorate any function we want to have this behavior on.</p>
  
  <p>I saw <a href="https://stackoverflow.com/questions/45312439/airflow-default-on-failure-callback">this</a> and try to implement it like this: </p>
  
  <pre><code>def on_failure_callback(context):
      operator = PythonOperator(
          python_callable=failure)
  
      return operator.execute(context=context)
  
  
  def failure():
      return 'Failure in the failure func'
  
  
  dag_args = {
      "retries": 2,
      "retry_delay": timedelta(minutes=2),
      'on_failure_callback': on_failure_callback
  }
  </code></pre>
  
  <p>And then on the DAG definition, I use <code>[...] default_args=dag_args [...]</code>, but this option is not working.</p>
  
  <p>What is the best way to accomplish this? </p>
  
  <p>Thanks </p>