Asquator opened a new issue, #61119: URL: https://github.com/apache/airflow/issues/61119
### Description Currently, the `context` passed to a callback defined on `DAG` level looks pretty much the same as a `context` passed to a task callback. Thus, we the callback's code doesn't have a way to differentiate between the two cases (from experimentation I noted that the task-level callback has an `exception` field while the DAG callback doesn't, but it doesn't look reliable enough). I expected the DAG-level callback to not have a `task_instance` field, but apparently it points to the last task executed. I would propose injecting a new field into the context that points to the parent object (TI or DAG) that caused the callback to be called. ### Use case/motivation In my callback code I want to know which kind of callback was triggered and handle a failure accordingly. ### Related issues _No response_ ### Are you willing to submit a PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
