You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/06/24 14:59:02 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #16633: Support serialization of non-primitive values for classes extending BaseOperator and DAG

kaxil commented on a change in pull request #16633:
URL: https://github.com/apache/airflow/pull/16633#discussion_r658027093



##########
File path: airflow/serialization/serialized_objects.py
##########
@@ -186,13 +186,17 @@ def serialize_to_json(
             if cls._is_excluded(value, key, object_to_serialize):
                 continue
 
+            value = cls._serialize(value)
             if key in decorated_fields:
-                serialized_object[key] = cls._serialize(value)
-            else:
-                value = cls._serialize(value)
-                if isinstance(value, dict) and "__type" in value:
-                    value = value["__var"]
-                serialized_object[key] = value
+                pass
+            elif not (isinstance(value, dict) and "__type" in value):
+                pass
+            elif key in DAG.get_serialized_fields() | BaseOperator.get_serialized_fields():

Review comment:
       Currently, we already support overriding get_serialized_fields for a BaseOperator and it should be taken for:
   
   Example:
   https://github.com/apache/airflow/blob/d181604739c048c6969d8997dbaf8b159607904b/airflow/sensors/external_task.py#L299-L304
   




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org