0
0
Apache Airflowdevops~20 mins

Manual triggers and parameters in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Manual Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of manual trigger with parameters in Airflow CLI
You manually trigger an Airflow DAG named data_pipeline with parameters using the CLI command:

airflow dags trigger data_pipeline --conf '{"run_date": "2024-06-01"}'

What will be the output message shown in the terminal?
ADAG data_pipeline triggered without parameters
BError: Invalid JSON format in --conf parameter
CCreated <DagRun data_pipeline @ 2024-06-01T00:00:00+00:00: manual__2024-06-01T00:00:00+00:00, externally triggered: True>
DNo such DAG: data_pipeline
Attempts:
2 left
💡 Hint
Check the CLI output format when triggering DAGs with parameters.
🧠 Conceptual
intermediate
1:30remaining
Purpose of parameters in manual DAG triggers
Why do we use parameters when manually triggering an Airflow DAG?
ATo change the DAG code without redeploying
BTo automatically schedule the DAG for future runs
CTo disable the DAG temporarily
DTo customize the DAG run with specific input values for that execution
Attempts:
2 left
💡 Hint
Think about what changes between manual runs.
🔀 Workflow
advanced
2:30remaining
Correct order to manually trigger an Airflow DAG with parameters via UI
Arrange the steps in the correct order to manually trigger an Airflow DAG named etl_job with parameters using the Airflow web UI.
A1,2,3,4
B1,3,2,4
C2,1,3,4
D1,2,4,3
Attempts:
2 left
💡 Hint
Think about the natural navigation flow in the UI.
Troubleshoot
advanced
2:00remaining
Error when triggering DAG with invalid JSON parameters
You try to trigger a DAG manually with this CLI command:

airflow dags trigger my_dag --conf '{run_date: 2024-06-01}'

What error will you most likely see?
AKeyError: run_date not found
BJSONDecodeError: Expecting property name enclosed in double quotes
CTypeError: conf parameter must be a string
DNo error, DAG triggered successfully
Attempts:
2 left
💡 Hint
Check the JSON format rules for keys and strings.
Best Practice
expert
3:00remaining
Best practice for passing sensitive parameters in manual DAG triggers
When manually triggering an Airflow DAG that requires sensitive parameters (like passwords), what is the best practice?
AUse Airflow Variables or Connections to store sensitive data and reference them in the DAG code
BPass sensitive data directly in the --conf JSON parameter when triggering manually
CWrite sensitive data in plain text inside the DAG Python file
DSend sensitive data via email to the Airflow admin before triggering
Attempts:
2 left
💡 Hint
Think about security and avoiding exposure of secrets.