Your team is writing an Apache Airflow DAG in Cloud Composer that launches an ephemeral Dataproc cluster, submits a Spark job, and then deletes the cluster. The cluster must be deleted even if the Spark job fails so you do not leave costly resources running. Which Airflow configuration will best ensure that the task deleting the cluster always runs, regardless of the outcome of the upstream Spark job task?
Assign the delete task to an isolated Airflow queue to ensure it is not blocked by failed tasks in the default queue.
Set the trigger_rule argument of the DataprocDeleteClusterOperator to "all_done" so it runs after upstream tasks complete in any state.
Increase the retries parameter on the Spark job task and rely on retry exhaustion to terminate the cluster if the job continues to fail.
Enable depends_on_past=True on the delete task so it ignores the status of the current run and always executes.
In Airflow, a task's execution is governed by its trigger_rule. The default rule, all_success, schedules a task only when every upstream task has succeeded. For cleanup activities-such as tearing down an ephemeral Dataproc cluster-you need the task to run even when an upstream task fails or is skipped. Setting trigger_rule="all_done" (or the equivalent constant TriggerRule.ALL_DONE) on the DataprocDeleteClusterOperator meets this requirement because Airflow will execute the task once all directly upstream tasks have finished execution in any state (success, failed, or skipped). Options that rely on depends_on_past, additional retries, or queue settings do not change the fundamental trigger condition and therefore cannot guarantee execution after a failure.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the trigger_rule in Apache Airflow?
Open an interactive chat with Bash
What is Dataproc and why use it with Cloud Composer?
Open an interactive chat with Bash
What happens if `depends_on_past` is set to True in Airflow?
Open an interactive chat with Bash
What is a trigger_rule in Apache Airflow?
Open an interactive chat with Bash
What is the purpose of the DataprocDeleteClusterOperator in Airflow?
Open an interactive chat with Bash
How does Cloud Composer use Apache Airflow to manage GCP resources?
Open an interactive chat with Bash
GCP Professional Data Engineer
Maintaining and automating data workloads
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .