0
0
Apache Airflowdevops~10 mins

Trigger rules (all_success, one_success, none_failed) in Apache Airflow - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Trigger rules (all_success, one_success, none_failed)
Start Task Execution
Check Upstream Tasks Status
all_success?
YesRun Task
Skip Task
one_success?
YesRun Task
Skip Task
none_failed?
YesRun Task
No
Skip Task
The task checks upstream tasks' statuses and decides to run or skip based on the trigger rule: all_success requires all upstream tasks to succeed, one_success requires at least one success, none_failed requires no failures.
Execution Sample
Apache Airflow
task = PythonOperator(
    task_id='example',
    python_callable=my_func,
    trigger_rule='all_success'
)
This task runs only if all upstream tasks succeed.
Process Table
StepUpstream Tasks StatusTrigger RuleCondition Met?Action
1Task A: success, Task B: successall_successYesRun Task
2Task A: success, Task B: failedall_successNoSkip Task
3Task A: success, Task B: failedone_successYesRun Task
4Task A: failed, Task B: failedone_successNoSkip Task
5Task A: success, Task B: skippednone_failedYesRun Task
6Task A: success, Task B: failednone_failedNoSkip Task
7Task A: skipped, Task B: skippednone_failedYesRun Task
💡 Execution stops after deciding to run or skip the task based on the trigger rule condition.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6After Step 7
Upstream StatusesN/Asuccess, successsuccess, failedsuccess, failedfailed, failedsuccess, skippedsuccess, failedskipped, skipped
Trigger Ruleall_successall_successall_successone_successone_successnone_failednone_failednone_failed
Condition MetN/AYesNoYesNoYesNoYes
ActionN/ARunSkipRunSkipRunSkipRun
Key Moments - 3 Insights
Why does the task skip when one upstream task fails under 'all_success'?
Because 'all_success' requires every upstream task to succeed. The execution_table rows 1 and 2 show that if any upstream task fails, the condition is not met, so the task is skipped.
How can a task run if one upstream task is skipped under 'none_failed'?
The 'none_failed' rule allows the task to run as long as no upstream task failed. Skipped tasks do not count as failures. See execution_table row 5 where one task is skipped but the task still runs.
What happens if all upstream tasks fail under 'one_success'?
The task will skip because 'one_success' requires at least one success. Execution_table row 4 shows that with all failures, the condition is not met and the task is skipped.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at step 3, what is the action taken?
ARun Task
BSkip Task
CRetry Task
DFail Task
💡 Hint
Check the 'Action' column in execution_table row 3 where upstream tasks are success and failed with 'one_success' trigger.
At which step does the 'all_success' trigger rule cause the task to skip?
AStep 1
BStep 5
CStep 2
DStep 7
💡 Hint
Look at execution_table rows with 'all_success' trigger and find where 'Condition Met?' is 'No'.
If Task B status changes from 'failed' to 'success' at step 6, what would be the new action for 'none_failed'?
ASkip Task
BRun Task
CFail Task
DRetry Task
💡 Hint
Refer to variable_tracker for step 6 and understand that 'none_failed' requires no failures to run.
Concept Snapshot
Trigger rules decide if a task runs based on upstream tasks' states.
'all_success': run if all upstream succeed.
'one_success': run if at least one upstream succeeds.
'none_failed': run if no upstream failed (skipped allowed).
If condition not met, task is skipped.
Full Transcript
Trigger rules in Airflow control when a task runs based on the status of upstream tasks. The 'all_success' rule requires every upstream task to succeed before running the task. If any upstream task fails, the task is skipped. The 'one_success' rule runs the task if at least one upstream task succeeds; if all fail, the task is skipped. The 'none_failed' rule allows the task to run as long as no upstream task has failed; skipped tasks do not count as failures. The execution table shows different upstream task status combinations and the resulting action for each trigger rule. The variable tracker records how upstream statuses, trigger rules, conditions, and actions change step by step. Key moments clarify common confusions about why tasks run or skip under different rules. The visual quiz tests understanding by asking about specific steps and outcomes. The concept snapshot summarizes the trigger rules and their behavior in a quick reference format.