You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Richard Penman (JIRA)" <ji...@apache.org> on 2017/09/19 14:52:00 UTC

[jira] [Created] (AIRFLOW-1623) Clearing task in UI does not trigger on_kill method in operator

Richard Penman created AIRFLOW-1623:
---------------------------------------

             Summary: Clearing task in UI does not trigger on_kill method in operator
                 Key: AIRFLOW-1623
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1623
             Project: Apache Airflow
          Issue Type: Bug
          Components: operators
    Affects Versions: Airflow 2.0
            Reporter: Richard Penman
            Priority: Minor
             Fix For: Airflow 2.0


When a task is cleared in the UI it doesn't call the [operators on_kill() method|https://github.com/apache/incubator-airflow/blob/b2e1753f5b74ad1b6e0889f7b784ce69623c95ce/airflow/models.py#L2380] to clean up the task. Apparently this is meant to be handled in the [LocalTaskJob.on_kill()|https://github.com/apache/incubator-airflow/blob/b2e1753f5b74ad1b6e0889f7b784ce69623c95ce/airflow/jobs.py#L2512] method, however it is not currently.

The obvious fix was suggested by Joy Gao on the mailing list to insert _self.task_instance.task.on_kill()_ here. This successfully triggers the operator on_kill() method, however the state of the operator instance is lost - a new instance is used here without variables set in the _execute()_ method. For example the [BashOperator|https://github.com/apache/incubator-airflow/blob/master/airflow/operators/bash_operator.py#L89] stores a reference to the process in
_self.sp_ and so calling _on_kill()_ on a new instance would raise an _AttributeError_. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)