-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Fix triggerer errors after Airflow 2 to 3 migration#55884
Fix triggerer errors after Airflow 2 to 3 migration#55884ephraimbuddy merged 4 commits intoapache:mainfrom
Conversation
When upgrading from Airflow 2, existing deferred triggers can reference TaskInstances without a dag_version_id and DagRuns with conf=None. This caused errors when the triggerer tried to start those triggers and when workers consumed ti_run responses.
This change:
- Skips starting triggers whose TaskInstance lacks dag_version_id, logging a warning instead of erroring
- Coerces DagRun.conf from None to {} in the ti_run response for compatibility with Airflow 2-era data
- Adds unit tests covering both behaviors
This prevents triggerer crashes and makes deferred tasks resume reliably after migration.
closes: #55713
How to test:
set a fernet key e.g:
export AIRFLOW__CORE__FERNET_KEY='8janSoQD86ALy_tnJjR-hcxNweHnUxhfDV61TBntr_4='
in both init.sh and environment_variables.env in airflow source.
AF2 uses init.sh for breeze but environment_variables.env is used in AF3.
Switch to airflow 2: git switch apache/v2-11-stable
Add this dag with the target time adjusted to maybe 30mins in the future:
from airflow import DAG
from airflow.sensors.date_time import DateTimeSensorAsync
with (DAG("async_trigger_sleep", start_date=datetime(2025,9,17),tags=["async_migration"])
) as dag:
DateTimeSensorAsync(
task_id="wait_for_start",
target_time=datetime(2025, 9, 19, 11, 26),
)
start breeze breeze start-airflow --backend postgres --executor CeleryExecutor
Trigger the dag above and stop breeze once the task is deferred.
Switch to Airflow 3: git switch main
Start breeze: breeze start-airflow --backend postgres --executor CeleryExecutor
See that when the target time reach, the dag would be successful
|
We are having exactly the same issue, and it is causing the crash of the scheduler. Any plan to release it soon? |
45b6da9 to
9047086
Compare
9047086 to
43bca86
Compare
TaskInstances without a dag_version_id and DagRuns with conf=None. This
caused errors when the triggerer tried to start those triggers and when
workers consumed ti_run responses.
This change:
1. Skips starting triggers whose TaskInstance lacks dag_version_id, logging
a warning instead of erroring
2. Coerces DagRun.conf from None to {} in the ti_run response for
compatibility with Airflow 2-era data
3. Adds unit tests covering both behaviors
This prevents triggerer crashes and makes deferred tasks resume reliably
after migration.
43bca86 to
fef8897
Compare
When upgrading from Airflow 2, existing deferred triggers can reference
TaskInstances without a dag_version_id and DagRuns with conf=None. This
caused errors when the triggerer tried to start those triggers and when
workers consumed ti_run responses.
This change:
1. Skips starting triggers whose TaskInstance lacks dag_version_id, logging
a warning instead of erroring
2. Coerces DagRun.conf from None to {} in the ti_run response for
compatibility with Airflow 2-era data
3. Adds unit tests covering both behaviors
This prevents triggerer crashes and makes deferred tasks resume reliably
after migration.
* Remove config check as that has been addressed in a different PR
* Add comment on why we added this
* Remove null conf test
(cherry picked from commit 7cec2a7)