AlexSingle commented on issue #61208:
URL: https://github.com/apache/airflow/issues/61208#issuecomment-3823592915
Okay, I was able to reproduce it. The problem was when I turn one task into
a task group with the same name. In some cases, I don't remove the dependency
on the old task, but replace it with a new sensor. Then I combine the sensor
and task into a new group. It displays correctly if I delete old runs, but the
problem persists when there are old runs with a different scheme.
Minimal example
```
from airflow import DAG
from airflow.providers.standard.sensors.python import PythonSensor
from airflow.providers.standard.operators.python import PythonOperator
from airflow.sdk import TaskGroup
import pendulum
DEFAULT_ARGS = {
'owner': 'airflow',
'depends_on_past': False,
'retries': 0,
}
def always_true():
return True
with DAG(
dag_id='test_broken_group_new',
default_args=DEFAULT_ARGS,
schedule='* * * * *',
start_date=pendulum.datetime(2026, 1, 28),
catchup=False,
tags=['test'],
) as dag:
with TaskGroup(group_id='group_b') as group_b:
task_b = PythonOperator(
task_id='task_b',
python_callable=always_true,
)
with TaskGroup(group_id='group_a') as group_a:
task_a1 = PythonOperator(
task_id='task_a1',
python_callable=always_true,
)
task_a2 = PythonOperator(
task_id='task_a2',
python_callable=always_true,
)
task_b >> task_a1
task_b >> task_a2
```
and then I replace the dag with this one
```
from airflow import DAG
from airflow.providers.standard.sensors.python import PythonSensor
from airflow.providers.standard.operators.python import PythonOperator
from airflow.sdk import TaskGroup
import pendulum
DEFAULT_ARGS = {
'owner': 'airflow',
'depends_on_past': False,
'retries': 0,
}
def always_true():
return True
with DAG(
dag_id='test_broken_group_new',
default_args=DEFAULT_ARGS,
schedule='* * * * *',
start_date=pendulum.datetime(2026, 1, 28),
catchup=False,
tags=['test'],
) as dag:
with TaskGroup(group_id='group_a') as group_a:
with TaskGroup(group_id='task_a1') as subgroup_a1:
task_a1_sensor = PythonSensor(
task_id='task_a1_sensor',
python_callable=always_true,
mode='poke',
poke_interval=10,
)
task_a1 = PythonOperator(
task_id='task_a1',
python_callable=always_true,
)
with TaskGroup(group_id='task_a2') as subgroup_a2:
task_a2_sensor = PythonSensor(
task_id='task_a2_sensor',
python_callable=always_true,
mode='poke',
poke_interval=10,
)
task_a2 = PythonOperator(
task_id='task_a2',
python_callable=always_true,
)
task_a1_sensor >> task_a1
task_a2_sensor >> task_a2
```
--
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]