Desdroid commented on code in PR #68901:
URL: https://github.com/apache/airflow/pull/68901#discussion_r3466389347


##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -580,6 +579,10 @@ def serialize(
             return TaskGroupSerialization.serialize_task_group(var)
         elif isinstance(var, Param):
             return cls._encode(cls._serialize_param(var), type_=DAT.PARAM)
+        elif isinstance(var, DagParam):
+            return cls._encode(
+                cls._serialize_param(Param(default=var._default, 
source="dag")), type_=DAT.PARAM
+            )

Review Comment:
   You're right, I don't think that's the correct thing to do. In `op_args` the 
serialized representation is used after DagParam went through 
`serialize_template_field`. For the `partial_kwargs` this path is not taken and 
what I did here will not work properly on runtime, i got confused while 
debugging in the heat.
   I don't really know how a fix for this should look like - I think either 
`serialize_mapped_operator` needs to be adapted and possibly should use 
`serialize_template_field`  for the `partial_kwargs` ops or an own 
Serialization class is needed for `DagParam` possibly similar to `XComArg`?
   If somebody is willing to point me in a direction, I am also open to 
contribute a fix. 
   I'm closing this PR and will open a bug report instead. 
   We found a workaround using Jinja Templates for DagParams in partial for now.
   ```pyhton
   
   add.partial(value="{{ params.p }}").expand(value=[1, 2, 3])
   ```
   Sorry for the confusion. 



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