Repository navigation
[v3-4-test] Read XCom without object reconstruction during dependency evaluation (#72718) - #75117
Merged
Merged
Conversation
… evaluation (#72718) * Read XCom without object reconstruction during dependency evaluation The scheduler evaluates task dependencies in-process, and two of those deps read XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits from SkipMixin, and both it and TriggerRuleDep read past_depends_met when wait_for_past_depends_before_skipping applies. Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow serialization module with full=True, so any nested dict carrying __classname__ is imported and instantiated. The values these deps actually consume are primitives: a mapping of lists of task ids, and a boolean. Nothing here needs an object rebuilt, so the scheduler can read these values as plain JSON. Add XComModel.deserialize_value_primitives, a plain json.loads with no object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True through TaskInstance.xcom_pull and pass full=False at the four dep call sites. All three of xcom_pull's return paths are covered -- the direct one, and both lazy-sequence ones, which is the path a mapped task instance takes. The skip decisions of SkipMixin tasks in the same mapped task group, which NotPreviouslySkippedDep reads with one query per pass, are decoded the same way. NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping before testing membership in it. It reads whatever the parent task wrote, so a scalar there previously raised TypeError inside dependency evaluation rather than being ignored. Because the payload is now plain JSON, a set or tuple of task ids arrives as its serde wrapper; its items are read from the wrapper without constructing anything, and a decision whose task ids are not a list of strings is ignored the same way. Task code pulling another task's return value is unchanged and still gets the original Python object; only the dependency-evaluation reads are narrowed. Generated-by: Claude Opus 5 * Treat only a literal True as past-depends-met during dependency evaluation Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions * Ignore skip decisions with a non-string classname (cherry picked from commit a7ac937) Co-authored-by: Jarek Potiuk <[email protected]> Generated-by: Claude Opus 5
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Oct 20, 2026
… evaluation (#72718) (#75117) * Read XCom without object reconstruction during dependency evaluation The scheduler evaluates task dependencies in-process, and two of those deps read XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits from SkipMixin, and both it and TriggerRuleDep read past_depends_met when wait_for_past_depends_before_skipping applies. Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow serialization module with full=True, so any nested dict carrying __classname__ is imported and instantiated. The values these deps actually consume are primitives: a mapping of lists of task ids, and a boolean. Nothing here needs an object rebuilt, so the scheduler can read these values as plain JSON. Add XComModel.deserialize_value_primitives, a plain json.loads with no object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True through TaskInstance.xcom_pull and pass full=False at the four dep call sites. All three of xcom_pull's return paths are covered -- the direct one, and both lazy-sequence ones, which is the path a mapped task instance takes. The skip decisions of SkipMixin tasks in the same mapped task group, which NotPreviouslySkippedDep reads with one query per pass, are decoded the same way. NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping before testing membership in it. It reads whatever the parent task wrote, so a scalar there previously raised TypeError inside dependency evaluation rather than being ignored. Because the payload is now plain JSON, a set or tuple of task ids arrives as its serde wrapper; its items are read from the wrapper without constructing anything, and a decision whose task ids are not a list of strings is ignored the same way. Task code pulling another task's return value is unchanged and still gets the original Python object; only the dependency-evaluation reads are narrowed. Generated-by: Claude Opus 5 * Treat only a literal True as past-depends-met during dependency evaluation Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions * Ignore skip decisions with a non-string classname (cherry picked from commit a7ac937) Generated-by: Claude Opus 5 Co-authored-by: Jarek Potiuk <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scheduler evaluates task dependencies in-process, and two of those deps read
XCom: NotPreviouslySkippedDep reads skipmixin_key for every parent that inherits
from SkipMixin, and both it and TriggerRuleDep read past_depends_met when
wait_for_past_depends_before_skipping applies.
Both went through TaskInstance.xcom_pull -> XComModel.deserialize_value, which is
json.loads(value, cls=XComDecoder). XComDecoder's object_hook calls the Airflow
serialization module with full=True, so any nested dict carrying classname is
imported and instantiated. The values these deps actually consume are primitives:
a mapping of lists of task ids, and a boolean. Nothing here needs an object
rebuilt, so the scheduler can read these values as plain JSON.
Add XComModel.deserialize_value_primitives, a plain json.loads with no
object_hook, and LazyXComPrimitivesSelectSequence alongside it. Thread full=True
through TaskInstance.xcom_pull and pass full=False at the four dep call sites.
All three of xcom_pull's return paths are covered -- the direct one, and both
lazy-sequence ones, which is the path a mapped task instance takes. The skip
decisions of SkipMixin tasks in the same mapped task group, which
NotPreviouslySkippedDep reads with one query per pass, are decoded the same way.
NotPreviouslySkippedDep also now checks that the skipmixin payload is a mapping
before testing membership in it. It reads whatever the parent task wrote, so a
scalar there previously raised TypeError inside dependency evaluation rather than
being ignored. Because the payload is now plain JSON, a set or tuple of task ids
arrives as its serde wrapper; its items are read from the wrapper without
constructing anything, and a decision whose task ids are not a list of strings is
ignored the same way.
Task code pulling another task's return value is unchanged and still gets the
original Python object; only the dependency-evaluation reads are narrowed.
Generated-by: Claude Opus 5
Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
(cherry picked from commit a7ac937)
Co-authored-by: Jarek Potiuk [email protected]
Generated-by: Claude Opus 5