Apache Airflow is a tool to help schedule and manage workflows or tasks automatically, like setting reminders to do chores but for computer jobs.
Click to reveal answer
beginner
Which command installs Apache Airflow using pip with constraints?
Use pip install apache-airflow==2.7.1 --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.7.1/constraints-3.12.txt to install Airflow safely with matching dependencies.
Click to reveal answer
intermediate
Why do we use constraints file when installing Airflow?
Constraints file locks the versions of Airflow dependencies to avoid conflicts and errors, like following a recipe exactly to bake a cake.
Click to reveal answer
beginner
What is the purpose of initializing the Airflow database?
Initializing the database sets up the place where Airflow stores info about tasks and workflows, like setting up a notebook to track your to-do list.
Click to reveal answer
beginner
How do you start the Airflow web server locally?
Run airflow webserver --port 8080 to start the Airflow web interface on your computer at port 8080.
Click to reveal answer
What is the first step to install Airflow locally?
ACreate a DAG file
BRun airflow webserver
CInitialize Airflow database
DSet up a Python virtual environment
✗ Incorrect
Setting up a Python virtual environment keeps Airflow installation clean and isolated.
Which command installs Airflow with the correct dependencies?
Using the exact version and constraints URL ensures compatible dependencies.
What does the command airflow db init do?
AStarts the Airflow scheduler
BStarts the Airflow webserver
CInitializes the Airflow metadata database
DRuns all workflows
✗ Incorrect
It sets up the database Airflow uses to track workflows and tasks.
Which port does Airflow webserver use by default when started locally?
A8080
B5000
C80
D443
✗ Incorrect
Port 8080 is the default for Airflow webserver.
Why is it recommended to use a virtual environment for Airflow?
ATo speed up Airflow
BTo isolate Airflow and its dependencies from other Python projects
CTo make Airflow run on Windows
DTo avoid using pip
✗ Incorrect
Virtual environments keep project dependencies separate and avoid conflicts.
Describe the steps to install Apache Airflow locally on your computer.
Think about preparing your workspace, installing, setting up storage, and then running the app.
You got /4 concepts.
Explain why using a constraints file is important when installing Airflow.
Consider how following exact instructions helps avoid mistakes.
You got /4 concepts.
Practice
(1/5)
1. What is the first step to install Apache Airflow locally on your machine?
easy
A. Create an Airflow user
B. Start the Airflow webserver
C. Create and activate a Python virtual environment
D. Initialize the Airflow database
Solution
Step 1: Set up isolated Python environment
Creating and activating a virtual environment ensures Airflow and its dependencies do not interfere with other Python projects.
Step 2: Prepare for Airflow installation
Once the virtual environment is active, you can safely install Airflow using pip.
Final Answer:
Create and activate a Python virtual environment -> Option C
Quick Check:
First step = virtual environment setup [OK]
Hint: Always start with a virtual environment for Python projects [OK]
Common Mistakes:
Skipping virtual environment and installing globally
Trying to start Airflow before installation
Initializing database before installing Airflow
2. Which command correctly installs Apache Airflow with pip inside a virtual environment?
easy
A. pip install airflow
B. pip install airflow-webserver
C. pip install airflow==latest
D. pip install apache-airflow
Solution
Step 1: Use the official package name
The correct package name for Airflow on PyPI is 'apache-airflow'.
Step 2: Avoid incorrect or incomplete package names
Other options either use wrong names or non-existent packages.
Final Answer:
pip install apache-airflow -> Option D
Quick Check:
Correct package name = apache-airflow [OK]
Hint: Use 'apache-airflow' as the pip package name [OK]
Common Mistakes:
Using 'airflow' instead of 'apache-airflow'
Adding invalid version specifiers
Trying to install non-existent sub-packages
3. After installing Airflow, what is the output of running airflow db init?
medium
A. Initializes the Airflow metadata database
B. Creates a new Airflow user
C. Starts the Airflow webserver
D. Displays Airflow version information
Solution
Step 1: Understand the command purpose
The command 'airflow db init' sets up the metadata database needed for Airflow to track workflows and tasks.
Step 2: Differentiate from other commands
Starting the webserver, creating users, or showing version info are done with different commands.
Final Answer:
Initializes the Airflow metadata database -> Option A
Quick Check:
'airflow db init' = database initialization [OK]
Hint: Init command sets up Airflow's database, not the server [OK]
Common Mistakes:
Confusing db init with webserver start
Expecting user creation from db init
Thinking it shows version info
4. You run airflow webserver but get an error saying the database is not initialized. What should you do to fix this?
medium
A. Run airflow db init to initialize the database
B. Create a new Airflow user first
C. Restart the machine and try again
D. Install Airflow again using pip
Solution
Step 1: Identify the cause of the error
The error indicates the Airflow metadata database is missing or not set up.
Step 2: Initialize the database
Running 'airflow db init' creates the necessary database tables and schema.
Final Answer:
Run airflow db init to initialize the database -> Option A
Quick Check:
Database error fixed by db init command [OK]
Hint: Initialize database before starting webserver [OK]
Common Mistakes:
Skipping database initialization
Trying to create user before db init
Restarting machine without fixing db
5. Which sequence of commands correctly installs Airflow, initializes the database, creates an admin user, and starts the webserver and scheduler locally?
hard
A. pip install apache-airflow; airflow users create --username admin; airflow db init; airflow webserver; airflow scheduler