Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion airflow/serialization/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ def serialize_template_field(template_field: Any) -> str | dict | list | int | f
def is_jsonable(x):
try:
json.dumps(x)
return True
except (TypeError, OverflowError):
return False
else:
Comment thread
eumiro marked this conversation as resolved.
Outdated
return True

if not is_jsonable(template_field):
return str(template_field)
Expand Down
7 changes: 3 additions & 4 deletions airflow/serialization/serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,13 @@ def _stringify(classname: str, version: int, value: T | None) -> str:

s = f"{classname}@version={version}("
if isinstance(value, _primitives):
s += f"{value})"
Comment thread
potiuk marked this conversation as resolved.
Outdated
s += f"{value}"
elif isinstance(value, _builtin_collections):
# deserialized values can be != str
s += ",".join(str(deserialize(value, full=False)))
elif isinstance(value, dict):
for k, v in value.items():
s += f"{k}={deserialize(v, full=False)},"
s = s[:-1] + ")"
s += ",".join(f"{k}={deserialize(v, full=False)}" for k, v in value.items())
s += ")"

return s

Expand Down
2 changes: 1 addition & 1 deletion airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ def _deserialize_operator_extra_links(cls, encoded_op_links: list) -> dict[str,
# }
# )

_operator_link_class_path, data = list(_operator_links_source.items())[0]
_operator_link_class_path, data = next(iter(_operator_links_source.items()))
if _operator_link_class_path in get_operator_extra_links():
single_op_link_class = import_string(_operator_link_class_path)
elif _operator_link_class_path in plugins_manager.registered_operator_link_classes:
Expand Down