kacpermuda opened a new pull request, #70772:
URL: https://github.com/apache/airflow/pull/70772
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull
request.
Write a good git commit message following this guide:
https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the
documentation.
For user-facing UI changes, please attach before/after screenshots (or a
short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for
a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we
sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
The previous implementation called `DagBundleModel.get_team_name()` without
an explicit session. This triggered `@provide_session` to open a new
`create_session()`, which — for ORM `DagRun` objects in the scheduler loop —
resolves to the same scoped session and commits on exit. That commit fires
Airflow's `prohibit_commit` HA lock guard, producing errors in multi-scheduler
setups.
The fix switches to `object_session(dagrun)` to obtain the session the ORM
object is already attached to, then passes it explicitly to
`DagModel.get_team_name(dag_id, session=session)`, bypassing
`@provide_session`'s `create_session()` path entirely. A similar fix was
proposed in #70452; this PR simplifies it further by going directly through
`DagModel` instead of the bundle.
Once #70760 is in, no DB call will be required for scheduler-side events in
Airflow 3.3.1: the stamp is already in memory. However, the `_team_name`
attribute is private with no stability guarantee; the check is guarded with
`hasattr` and an `isinstance` check; so we might keep the db call here under
try/except with fallback to None.
Two new fields added as well:
`DagVersion.version_data` (added in Airflow 3.3) carries arbitrary DAG-level
metadata set at parse time. This PR surfaces it as `dag_version_data` in the
OpenLineage `DagRunInfo` facet. No logic — just reading the attribute and
attaching it to the event, guarded by `AIRFLOW_V_3_3_PLUS`.
`TaskInstance.note` is set when an operator or a user manually changes task
state in the UI. Attaching it to OpenLineage task events makes manual
interventions observable in lineage.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Sonnet 4.6)
Generated-by: Claude Code (Sonnet 4.6) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]