Repository navigation
Commit 1684182
Fix WatcherTrigger XCom fetch hanging dag.test() on Airflow 3.0
On Airflow 3.0, XCom.get_one (airflow.sdk) unconditionally imports
SUPERVISOR_COMMS, a symbol that only exists on Airflow 3.1+. Outside a
task-SDK supervisor process -- most notably dag.test(), which runs deferred
triggers inline -- that import raises, the deferred task is re-queued
forever, and the DAG run hangs silently.
Wrap the SDK XCom.get_one call in get_xcom_val_af3 with try/except ImportError
and fall back to the direct-DB ORM path (get_xcom_val_af2). The SDK path stays
primary on AF 3 (a real triggerer has SUPERVISOR_COMMS); only the
non-supervisor case falls back. On AF 3.0 ti.xcom_pull reads straight from
XComModel, so the fallback works without a supervisor.
Also drop the watcher_with_freshness_check.py AF-3.0 .airflowignore skip added
as a CI workaround in #2692, and add a regression test for the fallback.
Refs apache/airflow#51816, apache/airflow#59093, BOSS-405
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>1 parent 9b3a645 commit 1684182
3 files changed
Lines changed: 37 additions & 18 deletions
File tree
- cosmos/operators/_watcher
- tests
- operators/_watcher
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
55 | 73 | | |
56 | 74 | | |
57 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 73 | | |
85 | 74 | | |
86 | 75 | | |
| |||
0 commit comments