原文地址:https://airflow.apache.org/docs/apache-airflow/stable/cli-and-env-variables-ref.html

1. Command Line Interface

Airflow has a very rich command line interface that allows for many types of operation on a DAG, starting services, and supporting development and testing.

Note: For more information on usage CLI, see Using the Command Line Interface

  1. usage: airflow [-h] GROUP_OR_COMMAND ...

2. GROUP_OR_COMMAND

Possible choices:

  1. airflow celery [-h] COMMAND ...

Positional Arguments:

  • flower
  • stop
  • worker

    1) airflow celery flower

    1. airflow celery flower [-h] [-A BASIC_AUTH] [-a BROKER_API] [-D]
    2. [-c FLOWER_CONF] [-H HOSTNAME] [-l LOG_FILE]
    3. [--pid [PID]] [-p PORT] [--stderr STDERR]
    4. [--stdout STDOUT] [-u URL_PREFIX]
Named Arguments
Default Description
--basic-auth -A Securing Flower with Basic Authentication. Accepts user:password pairs separated by a comma. Example:
flower_basic_auth = user1:password1,user2:password2
--broker-api -a Broker API
--daemon -D False Daemonize instead of running in the foreground
--flower-conf -c Configuration file for flower
--hostname -H “0.0.0.0” Set the hostname on which to run the server
--log-file -l Location of the log file
--pid PID file location
--port -p 5555 The port on which to run the server
--stderr Redirect stderr to this file
--stdout Redirect stdout to this file
--url-prefix URL prefix for Flower

2) airflow celery stop

Stop the Celery worker gracefully

3) airflow celery worker

Start a Celery worker node

  1. airflow celery worker [-h] [-a AUTOSCALE] [-H CELERY_HOSTNAME]
  2. [-c CONCURRENCY] [-D] [-l LOG_FILE] [--pid [PID]]
  3. [-q QUEUES] [-s] [--stderr STDERR] [--stdout STDOUT]
  4. [-u UMASK] [--without-gossip] [--without-mingle]
Named Arguments
Default Descrption
--autoscale -a Minimum and Maximum number of worker to autoscale
--celery-hostname -H Set the hostname of celery worker if you have multiple workers on a single machine
--concurrency -c 16 The number of worker processes
--daemon -D False Daemonize instead of running in the foreground
--log-file -l Location of the log file
--pid PID file location
--queues -q “default” Comma delimited list of queues to serve
--skip-serve-logs -s False Don’t start the serve logs process along with the workers
--stderr Redirect stderr to this file
--stdout Redirect stdout to this file
--umask -u “0o077” Set the umask of celery worker in daemon mode
--without-gossip Flase Don’t subscribe to other workers events
--without-mingle Don’t synchronize with other workers at start-up

2.2 airflow check-sheet

Display cheat sheet

  1. airflow cheat-sheet [-h] [-v]
Named Arguments
Default Descrption
--verbose -v False Make logging output more verbose

2.3 airflow config

View configuration

  1. airflow config [-h] COMMAND ...

Positional Arguments:

  • get-value
  • list

    1) airflow config get-value

    Print the value of the configuration
    1. airflow config get-value [-h] section option

Positional Arguments:

  • section: The section name
  • option: The option name

    2) airflow config list

Named Arguments Default Descrption
--color “auto” Possible choices: on, auto, off, Do emit colored output

2.4 airflow connections

Manage connections

  1. airflow connections [-h] COMMAND ...

Positional Arguments:

  • add
  • delete
  • export
  • get
  • import
  • list