Skip to content

Conversation

@ephraimbuddy
Copy link
Contributor

@ephraimbuddy ephraimbuddy commented Dec 5, 2025

Dags using operators with dictionary values in template_fields (such as env_vars) were getting different hashes on each parse, even when the actual dictionary content was unchanged. This happened because serialize_template_field converts dictionaries to string using str(), which preserves insertion order. When dictionary ordering varies between parses (e.g., when env_vars comes from os.environ.copy()), the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary ordering differs in template fields.

Related: #56471

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
@ephraimbuddy ephraimbuddy added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Dec 5, 2025
Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE!

@potiuk
Copy link
Member

potiuk commented Dec 7, 2025

I guess that one should go to 3.1.4rc2 if we have it

@potiuk potiuk merged commit d46a9d1 into apache:main Dec 7, 2025
68 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 7, 2025
…unordered dicts (#59091)

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
(cherry picked from commit d46a9d1)

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

Backport successfully created: v3-1-test

Status Branch Result
v3-1-test PR Link

potiuk pushed a commit that referenced this pull request Dec 7, 2025
…unordered dicts (#59091) (#59175)

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
(cherry picked from commit d46a9d1)

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
@potiuk potiuk added this to the Airflow 3.1.4 milestone Dec 7, 2025
amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Dec 8, 2025
…cts (apache#59091)

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
ephraimbuddy added a commit that referenced this pull request Dec 8, 2025
…unordered dicts (#59091) (#59175)

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
(cherry picked from commit d46a9d1)

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
ephraimbuddy added a commit that referenced this pull request Dec 8, 2025
…unordered dicts (#59091) (#59175)

Dags using operators with dictionary values in template_fields (such as
env_vars) were getting different hashes on each parse, even when the
actual dictionary content was unchanged. This happened because
serialize_template_field converts dictionaries to string
using str(), which preserves insertion order. When dictionary ordering
varies between parses (e.g., when env_vars comes from os.environ.copy()),
the string representation differs, causing inconsistent hashing.

Prevents unnecessary Dag updates and reprocessing when only dictionary
ordering differs in template fields.
(cherry picked from commit d46a9d1)

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:serialization backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants