How to restart a failed task on Airflow

Chetan J picture Chetan J · Apr 7, 2017 · Viewed 22k times · Source

I am using a LocalExecutor and my dag has 3 tasks where task(C) is dependant on task(A). Task(B) and task(A) can run in parallel something like below

A-->C

B

So task(A) has failed and but task(B) ran fine. Task(C) is yet to run as task(A) has failed.

My question is how do i re run Task(A) alone so Task(C) runs once Task(A) completes and Airflow UI marks them as success.

Answer

jhnclvr picture jhnclvr · Apr 10, 2017

In the UI:

  1. Go to the dag, and dag run of the run you want to change
  2. Click on GraphView
  3. Click on task A
  4. Click "Clear"

This will let task A run again, and if it succeeds, task C should run. This works because when you clear a task's status, the scheduler will treat it as if it hadn't run before for this dag run.