github-actions[bot] opened a new pull request, #69315:
URL: https://github.com/apache/airflow/pull/69315

   * Fix non-deterministic serialization of mapped task retry_policy
   
   A mapped operator keeps retry_policy in partial_kwargs, but the 
mapped-operator
   serializer has no serializer for a RetryPolicy, so it fell back to str(obj) 
--
   embedding the object's per-process memory address. That made the serialized 
DAG
   non-deterministic: dag_hash changed on every parse, defeating write_dag's
   "unchanged" check and creating a new DagVersion on nearly every DAG-processor
   re-serialization (even for idle, never-run DAGs), polluting version history 
and
   bloating the metadata DB.
   
   Non-mapped operators already avoid this by excluding the object and storing 
only
   a has_retry_policy flag; this makes the mapped path do the same. Runtime is
   unaffected -- the worker re-parses the DAG source for the live policy.
   
   * Also strip retry_policy from DAG default_args serialization
   
   A RetryPolicy set via DAG default_args hit the same str(obj) fallback as the
   mapped-operator case, embedding a memory address and producing a new 
DagVersion
   on every parse. Route both the mapped partial_kwargs loop and the 
default_args
   cleanup through a shared has-flag set (callbacks + retry_policy) so the 
object is
   never serialized on either path.
   
   * Add negative test for mapped task without a retry_policy
   
   Mapped operators resolve has_retry_policy through 
_get_partial_kwargs_or_operator_default
   (falling back to SerializedBaseOperator's default) rather than the dataclass 
default, so the
   false case warrants its own test alongside the existing non-mapped one.
   
   * Hoist retry_policy test imports and assert default_args has_retry_policy
   
   Review follow-ups: move the retry_policy imports to module top (no 
collision, unlike
   the SDK DAG import which stays local), shrink the has-flag branch comment to 
point at
   _HAS_FLAG_FIELDS, and assert the positive side (has_retry_policy written, 
retry_policy
   stripped) in the default_args test.
   (cherry picked from commit b56771c8c73d0e5f7bdb7bb091c4a3409cc1f4ce)
   
   Co-authored-by: Rahul Vats <[email protected]>


-- 
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]

Reply via email to