Files
airflow/airflow-ctl
Dheeraj Turaga 4679a4e584 Add airflowctl dags drain command (#73225)
* Add airflowctl dags drain command

Dag draining already works through the REST API (scheduling_state) and
the UI, but there was no way to trigger it from airflowctl. Per this
repo's CLI policy, new commands achievable via the Public API belong in
airflowctl rather than the airflow CLI, so this adds the CLI entry point
there specifically.

* Regenerate airflowctl help images for the drain command

Keeps the docs/images SVG snapshot and its hash file in sync with the
new `airflowctl dags drain` command added in the previous commit.
2026-09-16 21:27:44 -05:00
..
…
…
…

airflowctl

A command-line tool for interacting with Apache Airflow instances through the Airflow REST API. It offers a convenient interface for performing common operations remotely without direct access to the Airflow scheduler or webserver.

Features

  • Communicates with Airflow instances through the REST API
  • Supports authentication using Airflow API tokens
  • Executes commands against remote Airflow deployments
  • Provides intuitive command organization with group-based structure
  • Includes detailed help documentation for all commands

Requirements

  • Python 3.10 or later (compatible with 3.10 <= Python <= 3.14)
  • Network access to an Apache Airflow instance with REST API enabled
  • [Recommended] Keyring backend installed in operating system for secure token storage.
    • In case there's no keyring available (common in headless environments) you can provide the token to each command. See the Security page for more information.

Usage

Access the tool from your terminal:

Command Line

airflowctl --help

Contributing

Want to help improve Apache Airflow? Check out our contributing documentation.

Additional Contribution Guidelines

  • Please ensure API is running while doing development testing.
  • There are two ways to have a CLI command,
    • Auto Generated Commands
    • Implemented Commands

Auto Generated Commands

Auto generation of commands directly from operations methods under airflow-ctl/src/airflowctl/api/operations.py. Whenever operation is mapped with proper datamodel and response model, it will be automatically added to the command.

You can check each command with airflowctl <command> --help to see the available options.

Implemented Commands

Implemented commands are the ones which are not auto generated and need to be implemented manually. You can check the implemented commands under airflow-ctl/src/airflowctl/clt/commands/.