dheerajturaga commented on code in PR #73915:
URL: https://github.com/apache/airflow/pull/73915#discussion_r4287066426
##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -212,22 +212,11 @@ def _eager_load_dag_run_for_validation() ->
tuple[LoaderOption, LoaderOption]:
def _resolve_ti_callback_bundle_info(ti: TaskInstance) -> tuple[str, str |
None, Any]:
- """
- Resolve the bundle name/version/version-data needed to build a
TaskCallbackRequest or EmailRequest.
-
- Used by the heartbeat-timeout purge path. Encapsulates the bundle-pinning
semantics: fall back
- to ``dag_model`` for legacy tasks with no ``dag_version`` (pre-AIP-66
migrations), and leave the
- bundle version unpinned when the dag run itself wasn't pinned
(``disable_bundle_versioning``),
- so the callback runs against the same code as the task did.
``process_executor_events`` inlines
- the same resolution for its externally-killed-task path.
- """
+ """Resolve bundle metadata for task callbacks and emails using the run's
execution bundle."""
bundle_name = ti.dag_version.bundle_name if ti.dag_version else
ti.dag_model.bundle_name
- bundle_version = (
- ti.dag_version.bundle_version
- if ti.dag_version and ti.dag_run.bundle_version is not None
- else ti.dag_run.bundle_version
- )
- version_data = _resolve_version_data(ti.dag_version,
ti.dag_run.bundle_version)
+ # A code-only update can advance the DagVersion's bundle while the run
stays pinned.
+ bundle_version = ti.dag_run.bundle_version
+ version_data = _resolve_version_data(ti.dag_run.created_dag_version,
ti.dag_run.bundle_version)
Review Comment:
Thanks, done. `_resolve_version_data` now returns the manifest only when the
Dag version's `bundle_version` still matches the run's pinned one, so a
manifest overwritten by a code-only update is dropped instead of being sent
with the older version. Task execution, Dag-run callbacks and the callback
workload use the same helper, so they get the guard too. (The callback helper
this comment was on has since moved to `dag_version.py`, and the triggerer's
callbacks use it as well.)
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @dheerajturaga 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]