-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Description
Apache Airflow version
main (development)
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Whenever a dagrun is not selected then gantt component is not displayed but the query to fetch task instances is still performed with runId as empty string which results in 404 and retries. Previously "~" was passed when there is no runId. When there is no dagrun selected then these queries can be skipped to avoid server load since gantt requires a runId is my assumption. Please correct me if I missed some use case to display gantt across dagruns which I remember was discussed sometime back.
Browser console error message
XHRGET
http://localhost:8000/api/v2/dags/example_hitl_operator/dagRuns//taskInstances
[HTTP/1.1 404 Not Found 3ms]
Relevant code
airflow/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx
Lines 110 to 121 in 893f627
| const { data: taskInstancesData, isLoading: tiLoading } = useTaskInstanceServiceGetTaskInstances( | |
| { | |
| dagId, | |
| dagRunId: runId, | |
| }, | |
| undefined, | |
| { | |
| enabled: Boolean(dagId), | |
| refetchInterval: (query) => | |
| query.state.data?.task_instances.some((ti) => isStatePending(ti.state)) ? refetchInterval : false, | |
| }, | |
| ); |
Something like below could be done
diff --git a/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx b/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx
index 655e86e19c..7dd8c65b5e 100644
--- a/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx
+++ b/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx
@@ -114,7 +114,7 @@ export const Gantt = ({ limit }: Props) => {
},
undefined,
{
- enabled: Boolean(dagId),
+ enabled: Boolean(dagId) && runId !== "",
refetchInterval: (query) =>
query.state.data?.task_instances.some((ti) => isStatePending(ti.state)) ? refetchInterval : false,
},What you think should happen instead?
No response
How to reproduce
- Go to a running dag page. Example http://localhost:8000/dags/example_hitl_operator
- Open console panel and see 404 requests with URL where runId is missing. http://localhost:8000/api/v2/dags/example_hitl_operator/dagRuns//taskInstances
Operating System
Ubuntu 20.04
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct