jscheffl opened a new issue, #54753:
URL: https://github.com/apache/airflow/issues/54753
### Apache Airflow version
main (development)
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
I opened Airflow UI on latest main and with "Integratio test" Dag (probably
also with every other Dag containing mapped tasks) the Graph View is not
displayed.
Saw the following error on API Server console:
```
AttributeError: 'MappedOperator' object has no attribute 'topological_sort'
INFO: 172.18.0.1:57154 - "GET
/ui/structure/structure_data?dag_id=integration_test&external_dependencies=false&version_number=1
HTTP/1.1" 500 Internal Server Error
INFO: 172.18.0.1:57152 - "GET
/ui/structure/structure_data?dag_id=integration_test HTTP/1.1" 500 Internal
Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File
"/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py",
line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py",
line 1054, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py",
line 113, in __call__
await self.middleware_stack(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line
186, in __call__
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line
164, in __call__
await self.app(scope, receive, _send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
29, in __call__
await responder(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
130, in __call__
await super().__call__(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
46, in __call__
await self.app(scope, receive, self.send_with_compression)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line
85, in __call__
await self.app(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py",
line 63, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
53, in wrapped_app
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
716, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
736, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
290, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
78, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
53, in wrapped_app
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
75, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line
302, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line
215, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/starlette/concurrency.py",
line 38, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line
56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line
2476, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File
"/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line
967, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File
"/opt/airflow/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py",
line 86, in structure_data
nodes = [task_group_to_dict(child) for child in
dag.task_group.topological_sort()]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/taskgroup.py",
line 711, in task_group_to_dict
task_group_to_dict(child, parent_group_is_mapped=parent_group_is_mapped
or is_mapped)
File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/taskgroup.py",
line 712, in task_group_to_dict
for child in get_task_group_children_getter()(task_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<attrs generated getattr
airflow.models.mappedoperator.MappedOperator>", line 11, in __getattr__
return super().__getattribute__(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MappedOperator' object has no attribute 'topological_sort'
ERROR: Exception in ASGI application
Traceback (most recent call last):
File
"/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py",
line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py",
line 1054, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py",
line 113, in __call__
await self.middleware_stack(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line
186, in __call__
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line
164, in __call__
await self.app(scope, receive, _send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
29, in __call__
await responder(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
130, in __call__
await super().__call__(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line
46, in __call__
await self.app(scope, receive, self.send_with_compression)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line
85, in __call__
await self.app(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py",
line 63, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
53, in wrapped_app
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
716, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
736, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
290, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
78, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
53, in wrapped_app
raise exc
File
"/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line
42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line
75, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line
302, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line
215, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/starlette/concurrency.py",
line 38, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line
56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line
2476, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File
"/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line
967, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File
"/opt/airflow/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure.py",
line 86, in structure_data
nodes = [task_group_to_dict(child) for child in
dag.task_group.topological_sort()]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/taskgroup.py",
line 711, in task_group_to_dict
task_group_to_dict(child, parent_group_is_mapped=parent_group_is_mapped
or is_mapped)
File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/taskgroup.py",
line 712, in task_group_to_dict
for child in get_task_group_children_getter()(task_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<attrs generated getattr
airflow.models.mappedoperator.MappedOperator>", line 11, in __getattr__
return super().__getattribute__(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MappedOperator' object has no attribute 'topological_sort'
```
### What you think should happen instead?
Chart should display :-D
### How to reproduce
Use latest main, start UI via breeze, open Graph view for any Dag with a
Dynamically Mapped Task
### Operating System
Ubuntu 24.04
### Versions of Apache Airflow Providers
not relevant
### Deployment
Other
### Deployment details
breeze start-airflow --python 3.12 --backend postgres --executor
LocalExecutor --load-example-dags
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]