You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bramhanandlingala (via GitHub)" <gi...@apache.org> on 2026/07/29 08:43:10 UTC

[PR] Fix DAGs list page Last Run/Next Run going stale after runs complete [airflow]

bramhanandlingala opened a new pull request, #70667:
URL: https://github.com/apache/airflow/pull/70667

   **Summary**
   The DAGs list page (`/dags`) stops auto-refreshing once none of the visible
   DAGs has a run in a pending state. Since that's the normal resting
   condition, "Last Run" and "Next Run" (and the Recent Tasks counts) go stale
   and never update again until a manual page reload.
   
   **Root cause**
   `useDags` and `useDagRunStateCounts` each set `refetchInterval: false`
   whenever no DAG on the current page is mid-run, permanently killing
   polling. Every other page in the UI instead uses
   `useAutoRefresh({ checkPendingRuns: true })`, which checks pending runs
   globally and scales the interval back instead of disabling it.
   
   **Fix**
   Route both hooks through the same `checkPendingRuns: true` mechanism
   already used elsewhere, instead of their own divergent, page-local gate.
   No visual/markup changes — purely a polling-behavior fix.
   
   closes: #70663
   
   Was generative AI tooling used to co-author this PR?
   
   - [X] Yes - Claude
   
   Generated-by: Claude following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix DAGs list page Last Run/Next Run going stale after runs complete [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #70667:
URL: https://github.com/apache/airflow/pull/70667#discussion_r3713696682


##########
airflow-core/src/airflow/ui/src/queries/useDags.tsx:
##########
@@ -80,14 +80,7 @@ export const useDags = ({
       teams,
     },
     undefined,
-    {
-      refetchInterval: (query) =>
-        query.state.data?.dags.some(
-          (dag) => !dag.is_paused && dag.latest_dag_runs.some((dr) => isStatePending(dr.state)),
-        )
-          ? refetchInterval
-          : false,
-    },
+    { refetchInterval },

Review Comment:
   The dags list UI is not a lightweight endpoint so we shouldn't constantly refretch it at the same interval.
   
   Instead of turning off the refresh with passing `false` we could back off with a `refetchInterval * 10`



##########
airflow-core/src/airflow/ui/src/queries/useDagRunStateCounts.tsx:
##########
@@ -17,29 +17,19 @@
  * under the License.
  */
 import { useDagServiceGetDagRunStateCountsUi } from "openapi/queries";
-import type { DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
-import { isStatePending, useAutoRefresh } from "src/utils";
+import { useAutoRefresh } from "src/utils";
 
-export const useDagRunStateCounts = ({
-  dagIds,
-  dags,
-}: {
-  readonly dagIds: ReadonlyArray<string>;
-  // Refresh predicate is derived from useDags' data so the counts query doesn't
-  // need to be loaded before it knows whether to poll — avoids a chicken-and-egg.
-  readonly dags: ReadonlyArray<DAGWithLatestDagRunsResponse> | undefined;
-}) => {
-  const refetchInterval = useAutoRefresh({});
-  const hasPendingRun =
-    dags?.some((dag) => !dag.is_paused && dag.latest_dag_runs.some((run) => isStatePending(run.state))) ??
-    false;
+export const useDagRunStateCounts = ({ dagIds }: { readonly dagIds: ReadonlyArray<string> }) => {
+  // checkPendingRuns: true checks for pending runs across *all* dags and scales the interval back
+  // rather than disabling polling outright once the currently displayed page has nothing pending.

Review Comment:
   We don't need this description



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix DAGs list page Last Run/Next Run going stale after runs complete [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #70667:
URL: https://github.com/apache/airflow/pull/70667#issuecomment-5282225636

   ### Backport failed to create: v3-3-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/31713683230'> Run details </a>
   
   Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
   
   In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-3-test</td>
           <td><a href="https://github.com/apache/airflow/commit/a19c3dd19bd4809dfb44577116b4a4afd3df8bed"><img src='https://img.shields.io/badge/Commit-a19c3dd-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   cherry_picker a19c3dd v3-3-test
   ```
   
   This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
   the files that need manual conflict resolution.
   
   After you have resolved the conflicts, you can continue the backport process by running:
   
   ```bash
   cherry_picker --continue
   ```
   
   If you don't have cherry-picker installed, see the [installation guide](https://github.com/apache/airflow/blob/main/dev/README.md#how-to-backport-pr-with-cherry-picker-cli).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix DAGs list page Last Run/Next Run going stale after runs complete [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #70667:
URL: https://github.com/apache/airflow/pull/70667


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org