Airflow Codespace Syntax
Airflow Codespace Syntax
export AIRFLOW_HOME="/workspaces/hands-on-introduction-data-engineering-
4395021/airflow" && pip install "apache-airflow==2.5.1" --constraint
"https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.7.txt"
creates user
The Airflow scheduler is a process that continually monitors all tasks and DAGs in Airflow. It
starts subprocesses that keep track of the heartbeat of all DAGs and checks whether any
active tasks can be triggered. Although it's possible to run the webserver without the
scheduler, it's also not recommended. Now let's switch back to Codespaces and see how to
run both the Airflow webserver and the scheduler.
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ airflow webserver -D
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ airflow dags list
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ airflow scheduler -D
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ cat $AIRFLOW_HOME/airflow-webserver.pid | xargs kill
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ echo "" > $AIRFLOW_HOME/airflow-webserver.pid
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ cat $AIRFLOW_HOME/airflow-scheduler.pid | xargs kill
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(02-02) $ echo "" > $AIRFLOW_HOME/airflow-scheduler.pid
Upon installation, Airflow will create an airflow.cfg file that lives in the Airflow installation
directory. To see where that directory is, you can run echo AIRFLOW_HOME.
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(main) $ echo $AIRFLOW_HOME
I start by checking if any of the environment variables have been set for Airflow. In this case,
it looks like I only have AIRFLOW_HOME set, so I should be good to go.
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(main) $ env | grep -i airflow
@mohansaid9 ➜ /workspaces/hands-on-introduction-data-engineering-4395021/airflow
(main) $ cat airflow.cfg | grep "dags_folder"