原文地址: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
usage: airflow [-h] GROUP_OR_COMMAND ...
2. GROUP_OR_COMMAND
Possible choices:
celery
- cheat-sheet
config
- connections
dags
db
- info
- jobs
- kerberos
- kubernetes
- plugins
- pools
- providers
- roles
- rotate-fernet-key
scheduler
- sync-perm
- tasks
- users
variables
- version
webserver
2.1 airflow celery
Start celery components. Works only when using CeleryExecutor. For more information, see https://airflow.apache.org/docs/apache-airflow/stable/executor/celery.html
airflow celery [-h] COMMAND ...
Positional Arguments:
- flower
- stop
- worker
1) airflow celery flower
airflow celery flower [-h] [-A BASIC_AUTH] [-a BROKER_API] [-D]
[-c FLOWER_CONF] [-H HOSTNAME] [-l LOG_FILE]
[--pid [PID]] [-p PORT] [--stderr STDERR]
[--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
airflow celery worker [-h] [-a AUTOSCALE] [-H CELERY_HOSTNAME]
[-c CONCURRENCY] [-D] [-l LOG_FILE] [--pid [PID]]
[-q QUEUES] [-s] [--stderr STDERR] [--stdout STDOUT]
[-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
airflow cheat-sheet [-h] [-v]
Named Arguments | Default | Descrption | |
---|---|---|---|
--verbose |
-v | False | Make logging output more verbose |
2.3 airflow config
View configuration
airflow config [-h] COMMAND ...
Positional Arguments:
- get-value
- list
1) airflow config get-value
Print the value of the configurationairflow config get-value [-h] section option
Positional Arguments:
Named Arguments | Default | Descrption |
---|---|---|
--color |
“auto” | Possible choices: on , auto , off , Do emit colored output |
2.4 airflow connections
Manage connections
airflow connections [-h] COMMAND ...
Positional Arguments:
- add
- delete
- export
- get
- import
- list