Dev-iL commented on code in PR #73966:
URL: https://github.com/apache/airflow/pull/73966#discussion_r4153294357


##########
AGENTS.local.md:
##########


Review Comment:
   Please remove `AGENTS.local.md` and `CLAUDE.local.md` from this PR - they 
refer to local configurations ("workforest") unavailable in the standard Breeze 
CI image. New gitignore entries seem justified.



##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -1336,10 +1336,10 @@ def get_task_instance_states(
     if map_index is not None:
         query = query.where(TI.map_index == map_index)
 
-    results = session.scalars(query).all()
+    results = (await session.scalars(query)).all()

Review Comment:
   _**This is an AI-assisted review comment.**_
   
   Moving the full-entity query into the async handler hydrates TaskInstances 
and their eagerly joined DagRuns on the API event loop.
   
   In a Breeze SQLite/aiosqlite HTTP probe returning 5,001 states from one run, 
warm requests stalled a coroutine on that loop for 693–755 ms, compared with 
12–15 ms at the base revision. Selecting only `run_id`, `task_id`, `map_index`, 
and `state` reduced the stall to 36–38 ms while returning HTTP 200 and all 
5,001 states. 
   
   Select those four columns with `await session.execute(...)` here and in 
`_get_group_tasks` at `task_instances.py:1411` to avoid loading the unused 
entities, and add a regression for event-loop availability.



-- 
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]

Reply via email to