uranusjr commented on a change in pull request #21505:
URL: https://github.com/apache/airflow/pull/21505#discussion_r804793596



##########
File path: airflow/decorators/base.py
##########
@@ -337,30 +361,47 @@ def _merge_kwargs(
     return {**kwargs1, **kwargs2}
 
 
[email protected](kw_only=True)
[email protected](kw_only=True, repr=False)
 class DecoratedMappedOperator(MappedOperator):
     """MappedOperator implementation for @task-decorated task function."""
 
     multiple_outputs: bool
     python_callable: Callable
 
-    def create_unmapped_operator(self, dag: "DAG") -> BaseOperator:
+    # We can't save these in partial_kwargs because op_args and op_kwargs need
+    # to be present in mapped_kwargs, and MappedOperator prevents duplication.
+    partial_op_kwargs: Dict[str, Any]
+
+    @classmethod
+    @cache
+    def get_serialized_fields(cls):
+        return MappedOperator.get_serialized_fields() | {"partial_op_kwargs"}

Review comment:
       Somehow `super()` doesn’t work here:
   
   ```pycon
   >>> from airflow.decorators.base import DecoratedMappedOperator
   >>> DecoratedMappedOperator.get_serialized_fields()
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/opt/airflow/airflow/decorators/base.py", line 378, in 
get_serialized_fields
       return super().get_serialized_fields() | {"partial_op_kwargs"}
   TypeError: super(type, obj): obj must be an instance or subtype of type
   ```
   
   I’m suspecting this has something to do with `@attr.define`.




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