The [DebugExecutor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/executors/debug_executor/index.html#airflow.executors.debug_executor.DebugExecutor)
is meant as a debug tool and can be used from IDE. It is a single process executor that queues [TaskInstance](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/models/taskinstance/index.html#airflow.models.taskinstance.TaskInstance)
and executes them by running _run_raw_task
method.
Due to its nature the executor can be used with SQLite database. When used with sensors the executor will change sensor mode to reschedule
to avoid blocking the execution of DAG.
Additionally DebugExecutor
can be used in a fail-fast mode that will make all other running or scheduled tasks fail immediately. To enable this option set AIRFLOW__DEBUG__FAIL_FAST=True
or adjust fail_fast
option in your airflow.cfg
. For more information on setting the configuration, see Setting Configuration Options.
IDE setup steps:
Add
main
block at the end of your DAG file to make it runnable. It will run a backfill job:if __name__ == '__main__':
from airflow.utils.state import State
dag.clear(dag_run_state=State.NONE)
dag.run()
Setup
AIRFLOW__CORE__EXECUTOR=DebugExecutor
in run configuration of your IDE. In this step you should also setup all environment variables required by your DAG.- Run / debug the DAG file.