Airflow CLI

Overview

This section includes reference documentation for the Airflow shell CLI.

The usage is as follows:

$ airflow COMMAND [GENERIC_OPTIONS] SUBCOMMAND [COMMAND_OPTIONS]

Miscellaneous commands

General-purpose Airflow commands.

Command Description

cheat-sheet

Displays cheat sheet

dag-processor

Starts a standalone DAG Processor instance

info

Shows information about the current Airflow and environment

kerberos

Starts a Kerberos ticket renewer

plugins

Dumps information about the loaded plugins

rotate-fernet-key

Rotates encrypted connection credentials and variables

scheduler

Starts a scheduler instance

standalone

Runs an all-in-one copy of Airflow

sync-perm

Upgrades permissions for existing roles and optionally DAGs

triggerer

Starts a triggerer instance

version

Shows the Airflow version

webserver

Starts an Airflow webserver instance

Celery components

The commands for managing Airflow Celery.

Command Description

flower

Starts a Celery Flower

stop

Stops the Celery worker gracefully

worker

Starts a Celery worker node

View configuration

The commands for viewing Airflow configuration.

Command Description

get-value

Prints the value of the configuration

list

Prints configuration options

Manage connections

The commands for managing Airflow connections.

Command Description

add

Adds a connection

webserver

Starts an Airflow webserver instance

delete

Deletes a connection

export

Exports connections

get

Displays a connection

import

Imports connections from a file

list

Lists connections

test

Tests a connection

Manage DAGs

The commands for managing DAGs.

Command Description

backfill

Runs subsections of a DAG for a specified date range

delete

Deletes all DB records related to the specified DAG

details

Displays information about a DAG

list

Lists all DAGs

list-import-errors

Lists all DAGs that have import errors

list-jobs

Lists jobs

list-runs

Lists DAG runs

next-execution

Displays the next DAG execution dates

pause

Pauses a DAG

report

Shows DAG loading report

reserialize

Re-serializes all DAGs by parsing the DAG files

show

Displays DAG tasks with their dependencies

show-dependencies

Displays DAGs with their dependencies

state

Displays the status of a DAG run

test

Executes a single DAG run

trigger

Triggers a DAG run

unpause

Resumes a paused DAG

Database operations

The commands for managing the Airflow database.

Command Description

check

Checks if the database can be reached

check-migrations

Checks if a migration has finished

clean

Purges old records in the metastore tables

downgrade

Downgrades the schema of the metadata database

drop-archived

Drops archived tables created through the db clean command

export-archived

Exports archived data from the archive tables

init

Initializes the metadata database

reset

Drops and rebuilds the metadata database

shell

Runs a shell to access the database

upgrade

Upgrades the metadata database to latest version

Manage jobs

The commands for managing Airflow jobs.

Command Description

check

Checks if a job is still alive

KubernetesExecutor tools

The commands for managing KubernetesExecutor.

Command Description

cleanup-pods

Cleans up Kubernetes pods (created by KubernetesExecutor/KubernetesPodOperator) in evicted/failed/succeeded/pending states

generate-dag-yaml

Generates YAML files for all tasks in a DAG. Useful for debugging tasks without launching them in a cluster

Manage pools

The commands for managing Airflow pools.

Command Description

delete

Deletes a pool

export

Exports all pools

get

Displays pool size

import

Imports pools

list

Displays the list of pools

set

Configures a pool

Display providers

The commands for displaying information about providers.

Command Description

auth

Displays information about API auth backends

behaviours

Displays information about registered connection types with custom behaviour

get

Displays detailed information about a provider

hooks

Lists registered provider hooks

links

Lists extra links registered by the providers

list

Lists installed providers

logging

Displays information about task logging handlers

secrets

Displays information about secret managing backends

widgets

Displays information about registered widgets connections

Manage roles

The commands for managing Airflow roles.

Command Description

add-perms

Adds permissions to a role

create

Creates a role

del-perms

Deletes role permissions

delete

Deletes a role

export

Exports roles (without permissions) from the database to a JSON file

import

Imports roles (without permissions) from a JSON file to the database

list

Lists roles

Manage tasks

The commands for managing Airflow tasks.

Command Description

clear

Clears a set of task instances

failed-deps

Returns the unmet dependencies for a task instance

list

Displays the tasks within a DAG

render

Displays a task instance templates

run

Runs a single task instance

state

Displays the status of a task instance

states-for-dag-run

Displays the status of all task instances in a DAG run

test

Tests a task instance

Manage users

The commands for managing Airflow users.

Command Description

add-role

Adds a role to a user

create

Creates a user

delete

Deletes a user

export

Exports all users

import

Imports users

list

Lists users

remove-role

Removes a role from a user

Manage variables

The commands for managing Airflow variables.

Command Description

delete

Deletes a variable

export

Exports all variables

get

Displays a variable

import

Imports variables

list

Lists variables

set

Edits a variable

Found a mistake? Seleсt text and press Ctrl+Enter to report it