wjddn279 commented on code in PR #63871:
URL: https://github.com/apache/airflow/pull/63871#discussion_r3051440848
##########
airflow-core/src/airflow/serialization/helpers.py:
##########
@@ -61,25 +65,28 @@ def translate_tuples_to_lists(obj: Any):
return {key: translate_tuples_to_lists(value) for key, value in
obj.items()}
return obj
- def sort_dict_recursively(obj: Any) -> Any:
- """Recursively sort dictionaries to ensure consistent ordering."""
+ def sort_and_make_static_dict_recursively(obj: Any) -> Any:
+ """Recursively sort dictionaries and make callable value static to
ensure consistent ordering."""
+ if callable(obj):
+ return make_callable_static(obj)
if isinstance(obj, dict):
- return {k: sort_dict_recursively(v) for k, v in
sorted(obj.items())}
+ return {k: sort_and_make_static_dict_recursively(v) for k, v in
sorted(obj.items())}
if isinstance(obj, list):
- return [sort_dict_recursively(item) for item in obj]
+ return [sort_and_make_static_dict_recursively(item) for item in
obj]
if isinstance(obj, tuple):
- return tuple(sort_dict_recursively(item) for item in obj)
- return obj
+ return tuple(sort_and_make_static_dict_recursively(item) for item
in obj)
+ return str(obj)
max_length = conf.getint("core", "max_templated_field_length")
- if not is_jsonable(template_field):
+ # If the callable objects is in dict value, it makes is_jsonable False.
+ # So, filter the case in here and handle it downside
+ if not is_jsonable(template_field) and not isinstance(template_field,
dict):
Review Comment:
don't need to affect to another logic
--
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]