How to stop/kill Airflow tasks from the UI How to stop/kill Airflow tasks from the UI python python

How to stop/kill Airflow tasks from the UI


In the DAGs screen you can see the running tasks:

enter image description here

Example

On 'Recent Tasks' press the running icon and Airflow will automatically run the search query with the filters for the Dag Id and State equal to 'running' and show the results on the Task Instances screen (you can find it manually on the tab Browse > Task Instances).

There you can select the presented tasks and set them to another state or delete them.

Please notice that if the DAG is currently running, the Airflow scheduler will start again the tasks you delete. So either you stop the DAG first by changing its state or stop the scheduler (if you are running on a test environment).


Simply set the task to failed state will stop the running task.

[2019-09-17 23:53:28,040] {logging_mixin.py:82} INFO - [2019-09-17 23:53:28,039] {jobs.py:2695} WARNING - State of this instance has been externally set to failed. Taking the poison pill.[2019-09-17 23:53:28,041] {helpers.py:240} INFO - Sending Signals.SIGTERM to GPID 20977


from airflow gitter (@villasv)

" Not gracefully, no. You can stop a dag (unmark as running) and clearthe tasks states or even delete them in the UI. The actual runningtasks in the executor won't stop, but might be killed if theexecutor realizes that it's not in the database anymore. "