tirkarthi opened a new issue, #55636:
URL: https://github.com/apache/airflow/issues/55636

   ### 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
   
   
https://github.com/apache/airflow/blob/893f6279e6bb68ed875b2959300f26a58dc98a4a/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx#L110-L121
   
   Something like below could be done
   
   ```diff
   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
   
   1. Go to a running dag page. Example 
http://localhost:8000/dags/example_hitl_operator
   2. 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
   
   - [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]

Reply via email to