This is an automated email from the ASF dual-hosted git repository. uranusjr 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 e5325cd2b7 Unify mapped task group lookup logic (#34637) e5325cd2b7 is described below commit e5325cd2b70af832dcb1dd8aac7bf81b50adcac7 Author: Tzu-ping Chung <uranu...@gmail.com> AuthorDate: Thu Sep 28 03:37:14 2023 +0800 Unify mapped task group lookup logic (#34637) --- airflow/models/abstractoperator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/airflow/models/abstractoperator.py b/airflow/models/abstractoperator.py index 62d839ac32..aa79555557 100644 --- a/airflow/models/abstractoperator.py +++ b/airflow/models/abstractoperator.py @@ -365,11 +365,9 @@ class AbstractOperator(Templater, DAGNode): :meta private: """ - parent = self.task_group - while parent is not None: - if isinstance(parent, MappedTaskGroup): - yield parent - parent = parent.task_group + if (group := self.task_group) is None: + return + yield from group.iter_mapped_task_groups() def get_closest_mapped_task_group(self) -> MappedTaskGroup | None: """Get the mapped task group "closest" to this task in the DAG.