This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ac76ceee536 Add __repr__ methods to serialized classes for better
debugging (#55860)
ac76ceee536 is described below
commit ac76ceee536cc9d265ec240ef568d51120f7a326
Author: Kaxil Naik <[email protected]>
AuthorDate: Fri Sep 19 01:14:50 2025 +0100
Add __repr__ methods to serialized classes for better debugging (#55860)
---
airflow-core/src/airflow/models/mappedoperator.py | 3 +++
airflow-core/src/airflow/serialization/definitions/taskgroup.py | 6 ++++++
airflow-core/src/airflow/serialization/serialized_objects.py | 6 ++++++
3 files changed, 15 insertions(+)
diff --git a/airflow-core/src/airflow/models/mappedoperator.py
b/airflow-core/src/airflow/models/mappedoperator.py
index 33d77215500..b29877e9228 100644
--- a/airflow-core/src/airflow/models/mappedoperator.py
+++ b/airflow-core/src/airflow/models/mappedoperator.py
@@ -140,6 +140,9 @@ class MappedOperator(DAGNode):
is_mapped: ClassVar[bool] = True
+ def __repr__(self) -> str:
+ return f"<SerializedMappedTask({self.task_type}): {self.task_id}>"
+
@property
def node_id(self) -> str:
return self.task_id
diff --git a/airflow-core/src/airflow/serialization/definitions/taskgroup.py
b/airflow-core/src/airflow/serialization/definitions/taskgroup.py
index fef9dad303a..4df819c97ec 100644
--- a/airflow-core/src/airflow/serialization/definitions/taskgroup.py
+++ b/airflow-core/src/airflow/serialization/definitions/taskgroup.py
@@ -62,6 +62,9 @@ class SerializedTaskGroup(DAGNode):
is_mapped: ClassVar[bool] = False
+ def __repr__(self) -> str:
+ return f"<SerializedTaskGroup: {self.group_id}>"
+
@staticmethod
def _iter_child(child):
"""Iterate over the children of this TaskGroup."""
@@ -258,6 +261,9 @@ class SerializedMappedTaskGroup(SerializedTaskGroup):
is_mapped: ClassVar[bool] = True
+ def __repr__(self) -> str:
+ return f"<SerializedMappedTaskGroup: {self.group_id}>"
+
@methodtools.lru_cache(maxsize=None)
def get_parse_time_mapped_ti_count(self) -> int:
"""
diff --git a/airflow-core/src/airflow/serialization/serialized_objects.py
b/airflow-core/src/airflow/serialization/serialized_objects.py
index d7a4007e588..ce1ce22d9ac 100644
--- a/airflow-core/src/airflow/serialization/serialized_objects.py
+++ b/airflow-core/src/airflow/serialization/serialized_objects.py
@@ -1339,6 +1339,9 @@ class SerializedBaseOperator(DAGNode, BaseSerialization):
getattr(self, c, None) == getattr(other, c, None) for c in
BaseOperator._comps
)
+ def __repr__(self) -> str:
+ return f"<SerializedTask({self.task_type}): {self.task_id}>"
+
@property
def node_id(self) -> str:
return self.task_id
@@ -2410,6 +2413,9 @@ class SerializedDAG(BaseSerialization):
self.tags = set()
self.template_searchpath = None
+ def __repr__(self) -> str:
+ return f"<SerializedDAG: {self.dag_id}>"
+
@staticmethod
def __get_constructor_defaults():
param_to_attr = {