ramitkataria commented on code in PR #55241:
URL: https://github.com/apache/airflow/pull/55241#discussion_r2330896292
##########
airflow-core/src/airflow/models/deadline.py:
##########
@@ -202,10 +202,20 @@ def handle_miss(self, session: Session):
"""Handle a missed deadline by running the callback in the appropriate
host and updating the `callback_state`."""
from airflow.sdk.definitions.deadline import AsyncCallback,
SyncCallback
+ def get_simple_context():
+ from airflow.api_fastapi.core_api.datamodels.dag_run import
DAGRunResponse
+
+ # TODO: Use the TaskAPI from within Triggerer to fetch full
context instead of sending this context
+ # from the scheduler
+ return {
+ "dag_run":
DAGRunResponse.model_validate(self.dagrun).model_dump(mode="json"),
+ "deadline": {"id": self.id, "deadline_time":
self.deadline_time},
+ }
+
if isinstance(self.callback, AsyncCallback):
callback_trigger = DeadlineCallbackTrigger(
callback_path=self.callback.path,
- callback_kwargs=self.callback.kwargs,
+ callback_kwargs=(self.callback.kwargs or {}) | {"context":
get_simple_context()},
Review Comment:
I set context as a reserved kwarg so that shouldn't be a problem, otherwise
they wouldn't get this provided context in the callback, potentially without
even knowing it exists
--
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]