Shally-Katariya commented on code in PR #59814:
URL: https://github.com/apache/airflow/pull/59814#discussion_r2649454114
##########
airflow-core/src/airflow/ui/src/pages/Dag/Tasks/Tasks.tsx:
##########
@@ -57,6 +66,52 @@ export const Tasks = () => {
dagId,
});
+ // Extract task IDs for batch fetching task instances
+ const taskIds = data?.tasks.map((task) => task.task_id ?? "").filter((id) =>
id) ?? [];
+
+ // Batch fetch task instances for all tasks in one API call
+ const {
+ data: taskInstancesData,
+ error: taskInstancesError,
+ isFetching: isFetchingTaskInstances,
+ } = useQuery({
+ enabled: Boolean(dagId) && taskIds.length > 0,
+ queryFn: () =>
+ TaskInstanceService.getTaskInstancesBatch({
+ dagId: "~",
+ dagRunId: "~",
+ requestBody: {
+ dag_ids: [dagId],
+ order_by: "-run_after",
Review Comment:
Thanks for catching this .
You’re right — `run_after` is not a valid ordering field for TaskInstance,
and using it results in a 400 error on the Tasks tab.
I verified this locally as well. We should switch to a supported ordering
field (or remove explicit ordering if not required).
--
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]