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



##########
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:
       Yes that is correct. It does work for the types we currently have in the 
code base because they are all primivite values.
   But if `recursion_depth` would be a complex (non-primitive) type, a 
dictionary for example, it would fail.

##########
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:
       Yes that is correct. It does work for the types we currently have in the 
code base because they are all primitive values.
   But if `recursion_depth` would be a complex (non-primitive) type, a 
dictionary for example, it would fail.




-- 
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:
[email protected]


Reply via email to