title: How to mark state of an airflow task as failed from its success callback?
body: <p><b>Can a task be marked failed from its "on_success_callback"</b></p>
  
  <h3>Use case:</h3>
  
  <p>The task executes and logs some information.<br><br>
  I process these logs in "on_success_callback" of the task and based on logs, I want to mark the state of task as failed.</p>
  
  <p><i>I have tried raising an exception in "on_success_callback" but it just logs that "on_success_callback" failed and marks the task as success.</i></p>
  
  <p>This is the code for my airflow task, <br>dag_utils is a python file which gives implementation of task_callback in which I process the logs:
  <code></p>
  
  <pre><code>airflow_task = BashOperator(
      task_id='task1',
      bash_command = dag_utils.make_full_command(cmd),
      trigger_rule=TriggerRule.ALL_SUCCESS,
      on_failure_callback = dag_utils.task_callback,
      on_success_callback = dag_utils.task_callback,
      dag=dag
  )
  </code></pre>
  
  <p></code></p>