You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 63c494f
Browse filesBrowse the repository at this point in the historyBrowse files
Fix watcher ORM ban on Airflow 3.0 by detecting the supervisor at runtime
The previous version gate (airflow_supports_task_sdk_runtime, >= 3.1) routed
all of Airflow 3.0 to the direct-DB ORM path for both the producer task-state
fetch and the triggerer's XCom fetch. That premise -- "a triggerer is not a
task runner, so SUPERVISOR_COMMS is never bound on 3.0" -- is wrong:
- TriggererJobRunner.init_comms() binds task_runner.SUPERVISOR_COMMS and the
triggerer handles GetXCom and GetTaskStates over its comms channel, so the
task-SDK APIs DO work in a real 3.0 triggerer.
- A real 3.0 worker and triggerer both FORBID direct ORM access:
create_session raises "Direct database access via the ORM is not allowed in
Airflow 3.0" (supervisor.py).
- SUPERVISOR_COMMS is unbound only with no supervisor (dag.test() inline),
where the task-SDK raises ImportError/NameError and the ORM IS permitted.
A single version gate cannot tell "in a supervisor" from "not", so it crashed
3.0 in both the worker sensor poke (state fetch) and the triggerer (XCom fetch)
with the ORM-ban RuntimeError.
Decide at call time instead, on Airflow >= 3.0:
- state.py build_producer_state_fetcher: try get_task_states; on NameError
(no supervisor) fall back to the metadata-DB ORM.
- triggerer.py get_xcom_val: try XCom.get_one; on ImportError/NameError fall
back to the metadata-DB ORM.
Airflow < 3.0 keeps the ORM-only path (always permitted). Remove the now-unused
and misleading airflow_supports_task_sdk_runtime predicate from constants.
Update tests: producer-state AF3 tests run at 3.0.0 (the actual bug version)
plus a no-supervisor ORM-fallback case; get_xcom_val branch test expects the
task-SDK path on 3.0 plus an ImportError/NameError ORM-fallback case.
Refs apache/airflow#51816, apache/airflow#59093, BOSS-405
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
0 commit comments