kiran2706 opened a new pull request, #51949: URL: https://github.com/apache/airflow/pull/51949
### Summary This PR improves the behavior of on_success_callback and on_failure_callback at the DAG level by enriching the context passed to these callbacks. The enhancements aim to make the callback context more aligned with task-level callbacks, enabling better observability and consistency across alerting or automation hooks. Changes Included Updated handle_dag_callback to include additional context keys: dag_run, execution_date, data_interval_start, data_interval_end start_date, end_date, run_duration, conf, dag_run_url Task metadata (task_instance, try_number, log_url, etc.) if applicable Added alias ti for task_instance to support templating compatibility Extended unit tests to assert all relevant context keys for both success and failure callbacks Verified that the last relevant task instance (by end_date) is used in the context Motivation Previously, DAG-level callbacks received minimal context (dag, run_id, reason), which limited their usefulness for notification systems, post-processing logic, and debugging. This change brings DAG-level callback behavior closer to task-level, ensuring richer and more actionable context. Related Closes: [#51402] -- 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]
