D. Missing comma between bash_command and trigger_rule
Solution
Step 1: Check syntax of BashOperator parameters
Parameters must be separated by commas; here comma is missing after bash_command.
Step 2: Identify cause of syntax error
Missing comma causes Python syntax error, preventing DAG parsing.
Final Answer:
Missing comma between bash_command and trigger_rule -> Option D
Quick Check:
Comma missing = Syntax error [OK]
Hint: Check commas between parameters in Python code [OK]
Common Mistakes:
Thinking trigger_rule is invalid parameter
Assuming BashOperator can't run shell commands
Believing task_id naming causes error
5. You want to optimize cloud costs by running an Airflow DAG that starts instances only on weekdays at 9 AM and stops them at 6 PM. Which schedule_interval and task setup is best?
hard
A. schedule_interval='0 9 * * 1-5' to start, and a separate DAG with '0 18 * * 1-5' to stop
B. schedule_interval='@daily' for both start and stop tasks in one DAG
C. schedule_interval='0 9 * * *' to start and stop in same DAG immediately
D. No schedule_interval, run tasks manually when needed
Solution
Step 1: Choose schedule for weekdays only
'0 9 * * 1-5' runs at 9 AM Monday to Friday, matching requirement.
Step 2: Separate start and stop times
Stopping at 6 PM requires a different schedule '0 18 * * 1-5', best in separate DAG for clarity.
Final Answer:
schedule_interval='0 9 * * 1-5' to start, and a separate DAG with '0 18 * * 1-5' to stop -> Option A
Quick Check:
Separate schedules for start and stop on weekdays [OK]
Hint: Use cron for weekdays and separate DAGs for start/stop [OK]
Common Mistakes:
Using '@daily' runs every day, not weekdays only
Starting and stopping immediately in one DAG
Relying on manual runs instead of automation
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.