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
core: Append Dag file path to captured DagBag import warnings - #68185
Currently, when the DagBag parses files, certain captured warnings (like RemovedInAirflow3Warning or AirflowProviderDeprecationWarning) trigger from deep within Airflow core or provider internals. Because the warning's source points to the internal library code rather than the user's code, the resulting logs lack critical context, making it incredibly difficult for users managing large environments to identify which specific Dag file triggered the warning.
This PR wraps the warning interception layer within the DagBag import loop. It catches these warnings and dynamically appends the parsing context (the absolute or relative file path of the Dag) to the warning message before it is logged. This preserves the original warning category and stack trace while providing an immediate, actionable file path for users to go and fix.
Was generative AI tooling used to co-author this PR?
Yes
No
Note: Used an LLM assistant to help identify the warning interception patterns in dagbag.py and scaffold the initial unit tests. The core logic was reviewed and verified manually.
Note
✅ Ready for review · @mohsinsurani → @potiuk · 2026-06-12 13:30 UTC
Thanks @mohsinsurani — all checks are green and this PR is marked ready for maintainer review. The ball is with the maintainers now; a maintainer will take the next look.
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:
Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
Apache Airflow is a community-driven project and together we are making it better 🚀.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
Hi maintainers, gently checking in on this PR. It has been marked ready for maintainer review since June 12 and I believe the checks were green. I’m happy to rebase, adjust the approach, or add more tests if needed.
Closing this. #73853 removed dag_processing/importers/base.py and python_importer.py, two of the four files this changes, and #33853's request is already met on main: dagbag.py reports captured warnings as {source_reference}:{line_number}, where source_reference is the Dag file path. What's left would change the category of the re-emitted warning, which nothing asks for.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently, when the
DagBagparses files, certain captured warnings (likeRemovedInAirflow3WarningorAirflowProviderDeprecationWarning) trigger from deep within Airflow core or provider internals. Because the warning's source points to the internal library code rather than the user's code, the resulting logs lack critical context, making it incredibly difficult for users managing large environments to identify which specific Dag file triggered the warning.This PR wraps the warning interception layer within the
DagBagimport loop. It catches these warnings and dynamically appends the parsing context (the absolute or relative file path of the Dag) to the warning message before it is logged. This preserves the original warning category and stack trace while providing an immediate, actionable file path for users to go and fix.Related Issues
Closes: #33853
Was generative AI tooling used to co-author this PR?
Note: Used an LLM assistant to help identify the warning interception patterns in
dagbag.pyand scaffold the initial unit tests. The core logic was reviewed and verified manually.Note
✅ Ready for review · @mohsinsurani →
@potiuk· 2026-06-12 13:30 UTCThanks @mohsinsurani — all checks are green and this PR is marked ready for maintainer review. The ball is with the maintainers now; a maintainer will take the next look.
Automated triage — may be imperfect.