Qian Yu created AIRFLOW-6250:
--------------------------------
Summary: on_failure_callback does not know the task_id when
handle_failure() is called without passing context
Key: AIRFLOW-6250
URL: https://issues.apache.org/jira/browse/AIRFLOW-6250
Project: Apache Airflow
Issue Type: Improvement
Components: scheduler
Affects Versions: 1.10.6
Reporter: Qian Yu
The following code in scheduler_job.py can be hit e.g when
{{send_task_to_executor()}} in celery_executor.py is too slow and times out
after 2 seconds. But this call to {{handle_failure}}() is not passing a
{{context}} object.
So the {{on_failure_callback}} and on_retry_callback of tasks don't have an
idea about what task failed.
This can be fixed by making handle_failure() derive some reasonable default
value for the context argument.
{code:python}
simple_dag = simple_dag_bag.get_dag(dag_id)
dagbag = models.DagBag(simple_dag.full_filepath)
dag = dagbag.get_dag(dag_id)
ti.task = dag.get_task(task_id)
ti.handle_failure(msg)
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)