If you run Airflow locally and start it with the two commands airflow scheduler
and airflow webserver
, then those processes will run in the foreground. So, simply hitting Ctrl-C for each of them should terminate them and all their child processes.
If you don't have those two processes running in the foreground, there is another way. Airflow creates files with process IDs of the scheduler and gunicorn server in its home directory (by default ~/airflow/
).
Running
kill $(cat ~/airflow/airflow-scheduler.pid)
should terminate the scheduler.
Unfortunately, airflow-webserver.pid
contains the PID of the gunicorn server and not the initial Airflow command that started it (which is the parent of the gunicorn process). So, we will first have to find the parent PID of the gunicorn process and then kill the parent process.
Running
kill $(ps -o ppid= -p $(cat ~/airflow/airflow-webserver.pid))
should terminate the webserver.
If simply running kill
(i.e., sending SIGTERM) for these processes does not work you can always try sending SIGKILL: kill -9 <pid>
. This should definitely kill them.
NOTE: Starting with Airflow 2.2.0, there is the standalone
CLI command that runs all Airflow components, which are needed for local development. The command can be terminated with simple Ctrl-C
and it automatically shuts down all running components.
Ctrl + C
. – Episcopate