mohsinsurani opened a new pull request, #68185:
URL: https://github.com/apache/airflow/pull/68185

   ### Description
   
   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.
   
   ### Related Issues
   Closes: #33853
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] 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.*


-- 
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]

Reply via email to