You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ash Berlin-Taylor (Jira)" <ji...@apache.org> on 2019/12/16 09:57:00 UTC

[jira] [Resolved] (AIRFLOW-6250) on_failure_callback does not know the task_id when handle_failure() is called without passing context

     [ https://issues.apache.org/jira/browse/AIRFLOW-6250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ash Berlin-Taylor resolved AIRFLOW-6250.
----------------------------------------
    Fix Version/s: 1.10.7
       Resolution: Fixed

> 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
>            Assignee: Qian Yu
>            Priority: Major
>             Fix For: 1.10.7
>
>
> 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)