liveBook · Manning

Executor

As explained in Data Pipelines with Apache Airflow, Second Edition

An Airflow executor is an execution framework component that determines how workflow tasks are dispatched and run by workers.

A task can be ready to run without yet having a place to run. Airflow’s scheduler checks dependencies and available slots, then queues an eligible task instance. The executor takes responsibility for the queued task and starts it on a worker. Choosing an executor determines whether that work stays on one machine, spreads across machines, or runs in another environment. section 15.4.1 section 15.2

Choose according to where tasks must run and what the deployment can support:

  • LocalExecutor runs parallel worker subprocesses on one machine. It is easy to set up and fits a small, simple deployment, but cannot distribute tasks across machines. section 15.2.2 section 15.2.3
  • CeleryExecutor distributes tasks to Celery workers through a queue. It suits workloads that need multiple machines, at the cost of setting up a queuing mechanism. section 15.2.2
  • KubernetesExecutor runs tasks in Kubernetes pods. It offers containerized task isolation and scale-out, but requires a Kubernetes cluster and a more complex setup. section 15.2.2 section 15.2.3
  • EdgeExecutor can run workers outside the main Airflow environment—for example, on premises when Airflow runs in the cloud. It is experimental. section 15.2.2 section 15.10

Configure and verify an executor

Set `AIRFLOW__CORE__EXECUTOR=LocalExecutor` for a single-machine setup; in Airflow 3, LocalExecutor is already the default. Its subprocess limit is controlled by `AIRFLOW__CORE__PARALLELISM`, whose default is 32. Run a DAG to check the setup: a task reaching `running` has passed through scheduling, queuing, and executor pickup. Configuration can also be placed in `airflow.cfg`, although environment variables take precedence. section 15.2.3 section 15.2.1

Route tasks to different executors

A deployment can configure `CeleryExecutor,KubernetesExecutor` together and select an executor on a task, such as `BashOperator(task_id="hello_world", executor="LocalExecutor", bash_command="echo 'hello world!'")` when LocalExecutor is configured. In one mixed Celery/Kubernetes deployment, a task using Celery’s default image fails because TensorFlow is missing, while Kubernetes tasks using images with that dependency succeed. Executor choice can therefore affect both placement and which task dependencies are available. section 15.2.1 section 17.2.9

Table 15.1 Overview of Airflow executors

Executor

Distributed

Ease of installation

Good fit when

LocalExecutor

No

Easy

Running on a single machine is good enough.

CeleryExecutor

Yes

Moderate

You need to scale out over multiple machines.

KubernetesExecutor

Yes

Complex

You need to scale out over multiple machines, are familiar with Kubernetes, and prefer a containerized setup.

EdgeExecutor

Yes

Moderate

You need an executor to run outside the Airflow’s instance environment (e.g., on premises while Airflow is in the cloud).

Compare executor types by distribution, installation effort, and deployment fit before committing to an execution mode. section 15.2.2

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Explains the scheduler handoff, compares executor trade-offs, and gives configuration and installation checks without detailing every installation approach.
Examples
Uses an executor configuration setting, a task-level BashOperator selection, and a mixed-executor deployment with different task images.
What it assumes
Assumes familiarity with DAGs and tasks while recapping the scheduler, workers, and other Airflow components.
What you can do after
Operate/configure it by choosing an executor for the workload, setting its configuration, and checking that a DAG task reaches running.
How it connects
Links executors to the Airflow scheduler, task queues, workers, parallelism, Celery, and Kubernetes.

Also explained in

Compare how 3 books explain executor →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.