0
0
Apache Airflowdevops~20 mins

Multi-environment deployment (dev, staging, prod) in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-Environment Airflow Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use separate Airflow environments for dev, staging, and prod?

Which of the following is the main reason to maintain separate Airflow environments for development, staging, and production?

ATo increase the number of users who can access Airflow UI simultaneously
BTo isolate changes and test workflows safely before affecting production data
CTo reduce the number of DAGs that can be deployed
DTo save disk space by sharing logs across environments
Attempts:
2 left
💡 Hint

Think about why testing in a safe place before production is important.

💻 Command Output
intermediate
1:30remaining
Output of Airflow environment variable check

Given the following command run in the staging Airflow environment, what is the output?

echo $AIRFLOW_ENV
Astaging
Bproduction
Cdevelopment
Dundefined
Attempts:
2 left
💡 Hint

Check which environment variable is set for staging.

Configuration
advanced
2:30remaining
Correct Airflow config for environment-specific database URI

Which Airflow configuration snippet correctly sets the database URI for the production environment using environment variables?

A
[database]
sql_alchemy_conn = $PROD_DB_URI
B
[database]
sql_alchemy_conn = PROD_DB_URI
C
[database]
sql_alchemy_conn = ${PROD_DB_URI}
D
[database]
dsql_alchemy_conn = ${PROD_DB_URI}
Attempts:
2 left
💡 Hint

Check the correct config key spelling and environment variable syntax.

🔀 Workflow
advanced
3:00remaining
Best practice for deploying DAGs across environments

Which deployment workflow ensures safe promotion of DAGs from development to production in Airflow?

ADirectly commit DAGs to the production repository branch and deploy
BUse a single branch for all environments and toggle environment variables manually
CDeploy DAGs only in production and fix bugs live
DDevelop DAGs locally, push to a dev branch, test in dev environment, merge to staging branch for further testing, then merge to production branch for deployment
Attempts:
2 left
💡 Hint

Think about how to test changes progressively before production.

Troubleshoot
expert
3:00remaining
Why does the production Airflow environment fail to connect to the database?

The production Airflow environment suddenly fails to connect to its database. The error log shows: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server. The sql_alchemy_conn in airflow.cfg is set to ${PROD_DB_URI}. What is the most likely cause?

AThe environment variable PROD_DB_URI is not set or empty in the production environment
BThe Airflow scheduler is not running
CThe DAGs folder is empty
DThe Airflow webserver port is blocked by firewall
Attempts:
2 left
💡 Hint

Check if the environment variable used in the config is properly set.