seanghaeli commented on PR #66608: URL: https://github.com/apache/airflow/pull/66608#issuecomment-4566178617
@ramitkataria @ferruzzi Thanks for the thorough review! Here is a summary of what has been addressed: **Context and kwargs (handle_miss):** - callback.data["kwargs"] only contains deadline_id and deadline_time (user-facing deadline info). No context or DagRun identifiers are placed in kwargs. - dag_id and run_id remain at the top level of callback.data as routing metadata (not kwargs) so the triggerer supervisor and executor can locate the DagRun without DB queries at dispatch time. - dag_run_id (integer PK) is kept only for ExecutorCallback since the scheduler needs it to look up the DagRun when building the ExecuteCallback workload. **Triggerer path:** - _fetch_callback_dag_run_data() in triggerer_job_runner.py fetches the DagRun from DB using dag_id/run_id and serializes it into workload.dag_run_data — exactly the same field start_from_trigger uses (via dag_run.dag_run_data.model_dump()). - In create_triggers(), when workload.dag_run_data is set (and no TI), context is built via _build_context_from_dag_run_data(workload.dag_run_data) and set as trigger_instance.context = context — matching the trigger_instance.task_instance = ti pattern. - CallbackTrigger.run() reads self.context (renamed from _callback_context in latest commit). - run_trigger() is called with the built context so render_template_fields(context) is also invoked. **Executor path:** - Inside the callback subprocess, _fetch_and_build_context() sends GetDagRun via SUPERVISOR_COMMS to fetch the DagRun at execution time and builds a Context dict — matching how task subprocesses request data through comms. - dag_id/run_id are read from callback.data (top-level routing metadata) and passed to supervise_callback(dag_id=..., run_id=...). **Context type:** - build_context_from_dag_run() (shared helper in context.py) wraps all datetime fields with coerce_datetime() so they are pendulum DateTime objects (same as task context) rather than stdlib datetime. - The returned dict matches the standard DagRun-level context fields. **Old code removed:** - CallbackTrigger._build_context() (direct SUPERVISOR_COMMS call in the trigger) has been removed. - get_simple_context() in handle_miss (pre-serialized context in kwargs) has been removed. Please let me know if anything else needs adjustment! --- Drafted-by: Claude Code (claude-sonnet-4-6); reviewed by @seanghaeli before posting -- 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]
