guan404ming commented on code in PR #49830:
URL: https://github.com/apache/airflow/pull/49830#discussion_r2063580978
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/HistoricalMetrics.tsx:
##########
@@ -38,9 +40,31 @@ export const HistoricalMetrics = () => {
const [endDate, setEndDate] = useState(now.toISOString());
const [assetSortBy, setAssetSortBy] = useState("-timestamp");
- const { data, error, isLoading } = useDashboardServiceHistoricalMetrics({
- startDate,
- });
+ const refetchInterval = useAutoRefresh({});
+
+ const { data, error, isLoading } = useDashboardServiceHistoricalMetrics(
+ {
+ startDate,
+ },
+ undefined,
+ {
+ refetchInterval: (query) => {
+ const hasPendingTaskInstances = query.state.data?.task_instance_states
+ ? Object.entries(query.state.data.task_instance_states).some(
+ ([state, count]) => isStatePending(state as TaskInstanceState)
&& count > 0,
+ )
+ : false;
+
+ const hasPendingDagRuns = query.state.data?.dag_run_states
+ ? Object.entries(query.state.data.dag_run_states).some(
+ ([state, count]) => ["queued", "running"].includes(state) &&
count > 0,
Review Comment:
I add the `DagRunState` into `isStatePending` which then make sense
--
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]