[ https://issues.apache.org/jira/browse/AIRFLOW-1623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16171819#comment-16171819 ]
Richard Penman commented on AIRFLOW-1623: ----------------------------------------- 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_. > 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. -- This message was sent by Atlassian JIRA (v6.4.14#64029)