Apache Airflow version
main (development)
If "Other Airflow 3 version" selected, which one?
No response
What happened?
When a deferrable sensor with soft_fail=True times out, the task fails with AirflowSensorTimeout instead of being marked as SKIPPED. This is a regression from Airflow 2.x where the same configuration correctly skipped the task and downstream tasks.
Actual behavior in Airflow 3.x:
- Task state:
FAILED
- Error:
AirflowSensorTimeout: Trigger timeout
- Log shows:
TaskDeferralTimeout: Trigger timeout in BaseSensorOperator.resume_execution()
- Downstream tasks: Not executed
Workaround: Setting deferrable=False forces the sensor to use traditional poke mode, which correctly respects soft_fail=True on timeout.
What you think should happen instead?
A sensor configured with soft_fail=True should be marked as SKIPPED when it times out, regardless of whether it's running in deferrable mode or traditional poke mode. The soft_fail parameter should work consistently across all sensor modes.
Expected behavior (works in Airflow 2.x):
- Task state:
SKIPPED
- Downstream tasks:
SKIPPED (according to trigger rules)
- No
AirflowSensorTimeout exception raised
How to reproduce
from datetime import datetime, timedelta
from airflow.providers.standard.sensors.time_delta import TimeDeltaSensor
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.sdk import DAG
with DAG(
dag_id='test_sensor_soft_fail',
start_date=datetime(2024, 1, 1),
schedule=None,
) as dag:
# Sensor waiting for 1 hour but will timeout after 10 seconds
sensor = TimeDeltaSensor(
task_id='test_timedelta_sensor',
delta=timedelta(hours=1), # Wait for 1 hour
timeout=10, # But timeout after 10 seconds
soft_fail=True, # Should skip on timeout
deferrable=True, # Use deferrable mode
)
downstream = EmptyOperator(task_id='downstream_task')
sensor >> downstream
Steps:
- Run the DAG with
deferrable=True (as shown above)
- Wait for sensor to timeout after 10 seconds
- Observe task FAILS with
AirflowSensorTimeout and downstream task is not executed
- Change
deferrable=True to deferrable=False in the sensor configuration
- Run the DAG again with
deferrable=False
- Wait for sensor to timeout after 10 seconds
- Observe task is marked as SKIPPED and downstream task is also skipped (correct behavior)
Expected behavior (Airflow 2.x): Task skips on timeout regardless of deferrable mode
Actual behavior (Airflow 3.x):
- With
deferrable=True: Task FAILS on timeout
- With
deferrable=False: Task SKIPS on timeout (correct)
Operating System
Debian GNU/Linux 12 (bookworm)
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
main (development)
If "Other Airflow 3 version" selected, which one?
No response
What happened?
When a deferrable sensor with
soft_fail=Truetimes out, the task fails withAirflowSensorTimeoutinstead of being marked as SKIPPED. This is a regression from Airflow 2.x where the same configuration correctly skipped the task and downstream tasks.Actual behavior in Airflow 3.x:
FAILEDAirflowSensorTimeout: Trigger timeoutTaskDeferralTimeout: Trigger timeoutinBaseSensorOperator.resume_execution()Workaround: Setting
deferrable=Falseforces the sensor to use traditional poke mode, which correctly respectssoft_fail=Trueon timeout.What you think should happen instead?
A sensor configured with
soft_fail=Trueshould be marked asSKIPPEDwhen it times out, regardless of whether it's running in deferrable mode or traditional poke mode. Thesoft_failparameter should work consistently across all sensor modes.Expected behavior (works in Airflow 2.x):
SKIPPEDSKIPPED(according to trigger rules)AirflowSensorTimeoutexception raisedHow to reproduce
Steps:
deferrable=True(as shown above)AirflowSensorTimeoutand downstream task is not executeddeferrable=Truetodeferrable=Falsein the sensor configurationdeferrable=FalseExpected behavior (Airflow 2.x): Task skips on timeout regardless of deferrable mode
Actual behavior (Airflow 3.x):
deferrable=True: Task FAILS on timeoutdeferrable=False: Task SKIPS on timeout (correct)Operating System
Debian GNU/Linux 12 (bookworm)
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct