From c3da29c09cec3552040d43e4ef8bc65bd3a2f12a Mon Sep 17 00:00:00 2001
From: "2569718930@qq.com" <2569718930@qq.com>
Date: Wed, 8 Apr 2026 06:53:49 +0800
Subject: [PATCH] Add dashboard prewarm worker and cache visibility
---
docker-compose.yml | 11 +
frontend/app/loading.tsx | 5 +
.../components/dashboard/DashboardEntry.tsx | 2 +
.../dashboard/DashboardShellSkeleton.tsx | 105 ++++++
frontend/components/ops/OpsDashboard.tsx | 128 ++++++++
requirements.txt | 1 +
scripts/prewarm_dashboard_cache.py | 49 +++
scripts/prewarm_dashboard_worker.py | 65 ++++
src/bot/runtime_coordinator.py | 27 ++
src/data_collection/metar_sources.py | 6 +-
src/data_collection/mgm_sources.py | 14 +-
src/data_collection/nmc_sources.py | 20 +-
src/data_collection/nws_open_meteo_sources.py | 14 +-
src/data_collection/polymarket_readonly.py | 7 +-
src/data_collection/settlement_sources.py | 20 +-
src/data_collection/weather_sources.py | 91 ++++-
src/utils/prewarm_dashboard.py | 305 +++++++++++++++++
tests/test_web_observability.py | 6 +
web/analysis_service.py | 41 +++
web/core.py | 42 ++-
web/routes.py | 310 ++++++++++++------
21 files changed, 1120 insertions(+), 149 deletions(-)
create mode 100644 frontend/app/loading.tsx
create mode 100644 frontend/components/dashboard/DashboardShellSkeleton.tsx
create mode 100644 scripts/prewarm_dashboard_cache.py
create mode 100644 scripts/prewarm_dashboard_worker.py
create mode 100644 src/utils/prewarm_dashboard.py
diff --git a/docker-compose.yml b/docker-compose.yml
index 8a5b7741..083c5ab6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -34,6 +34,17 @@ services:
# UID/GID are mainly useful on Linux hosts to avoid root-owned output files.
user: "${UID:-1000}:${GID:-1000}"
+ polyweather_prewarm:
+ <<: *polyweather-base
+ container_name: polyweather_prewarm
+ restart: unless-stopped
+ profiles: ["workers"]
+ command: python scripts/prewarm_dashboard_worker.py --include-detail --include-market
+ volumes:
+ - ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
+ - ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/app/data
+ user: "${UID:-1000}:${GID:-1000}"
+
polyweather_prometheus:
image: prom/prometheus:v3.4.1
container_name: polyweather_prometheus
diff --git a/frontend/app/loading.tsx b/frontend/app/loading.tsx
new file mode 100644
index 00000000..e99baf0e
--- /dev/null
+++ b/frontend/app/loading.tsx
@@ -0,0 +1,5 @@
+import { DashboardShellSkeleton } from "@/components/dashboard/DashboardShellSkeleton";
+
+export default function Loading() {
+ return