You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by pi...@apache.org on 2026/10/02 09:24:33 UTC
(airflow) 01/01: Update the stale cycle-detection comment on SerializedTaskGroup.topological_sort
This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch pierrejeambrun/lang-sdk-e2e/cycle-comment-fix
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit db1aa687741a6fda96907a93b6ff7e3bbf6f0619
Author: pierrejeambrun <pi...@gmail.com>
AuthorDate: Fri Oct 2 11:23:33 2026 +0200
Update the stale cycle-detection comment on SerializedTaskGroup.topological_sort
DAG.check_cycle was the only guard this comment named, but a Lang-SDK Dag
never runs it: it has no Python DAG object to call it on. The Dag processor
now rejects a cyclic Lang-SDK Dag of its own accord, through
DagSerialization.validate_serialized_dag, so the comment should name both
guards rather than the one that does not cover every author.
---
airflow-core/src/airflow/serialization/definitions/taskgroup.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/airflow-core/src/airflow/serialization/definitions/taskgroup.py b/airflow-core/src/airflow/serialization/definitions/taskgroup.py
index b82e1c0b933..8e9fe75e6b2 100644
--- a/airflow-core/src/airflow/serialization/definitions/taskgroup.py
+++ b/airflow-core/src/airflow/serialization/definitions/taskgroup.py
@@ -237,9 +237,12 @@ class SerializedTaskGroup(TaskGroupMixin, DAGNode):
Sort children topologically — a task always comes after its upstream dependencies.
See ``TaskGroup.topological_sort`` in task-sdk for the algorithm. Cycles are
- treated as corrupt input: ``DAG.check_cycle`` rejects cyclic Dags before
- serialization, so a cycle reaching this code indicates malformed serialized data,
- and we raise ``ValueError`` rather than silently looping forever.
+ treated as corrupt input: a Python Dag's cycle is rejected by ``DAG.check_cycle``
+ before serialization, and a Lang-SDK Dag's cycle is rejected by
+ ``DagSerialization.validate_serialized_dag`` when the Dag processor receives it
+ (both call the shared ``detect_cycle``). A cycle reaching this code indicates
+ malformed serialized data, and we raise ``ValueError`` rather than silently
+ looping forever.
"""
children = self.children
if not children: