gingeekrishna commented on issue #68941:
URL: https://github.com/apache/airflow/issues/68941#issuecomment-4820742630

   ## Fix submitted in PR #69091
   
   **Root cause:** `BaseSerialization.serialize()` had no branch for 
`DagParam`, so it fell through to `str(var)` — which includes the object's 
memory address (e.g. `<DagParam object at 0x7f3a...>`). Since the address 
changes each time the scheduler parses the DAG, `partial_kwargs` serialized to 
a different value on every run, triggering a new DAG version write each cycle.
   
   **Fix:**
   
   1. Added `DAT.DAG_PARAM = dag_param` to the serialization type enum.
   2. Added a `DagParam` branch in `serialize()` that encodes the stable triple 
`(dag_id, name, default)`.
   3. Added a `_DagParamRef` NamedTuple (modelled on the existing `_XComRef` 
pattern for `XComArg`) as a deferred-resolution placeholder. 
`DagParam.__init__` requires a live DAG reference, which is not yet available 
when `partial_kwargs` are first deserialized — `_DagParamRef` stores the 
identity until `set_task_dag_references()` can attach the live DAG.
   4. Updated `set_task_dag_references()` to resolve `_DagParamRef` 
placeholders in `partial_kwargs` once the DAG is fully hydrated.
   
   Four regression tests were added covering: stable serialization (no memory 
address), full round-trip with correct `DagParam` reconstruction, version 
stability across multiple serializations, and `NOTSET` default preservation.


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