更新前端看板1

This commit is contained in:
wangjiming
2026-08-03 17:24:45 +08:00
parent 94230cad16
commit 62a1d03eac
7 changed files with 408 additions and 30 deletions

View File

@@ -2996,12 +2996,24 @@ class PlatformStore:
}
def health_metrics(self) -> dict[str, float]:
# Health checks must stay lightweight. The Docker healthcheck and page
# refresh probes should not wait on dashboard/GPU/database aggregation.
# 轻量健康检查:采集真实 CPU/内存/磁盘使用率
# 用于顶部栏快速展示与 Docker 健康检查。
try:
import psutil
# cpu_percent(interval=None) 首次调用返回 0需要短暂采样
cpu_percent = float(psutil.cpu_percent(interval=0.1))
memory_percent = float(psutil.virtual_memory().percent)
# Windows 兼容:尝试当前盘符
try:
disk_percent = float(psutil.disk_usage('/').percent)
except Exception:
disk_percent = float(psutil.disk_usage('C:\\').percent)
except Exception:
cpu_percent = memory_percent = disk_percent = 0.0
return {
"cpu_percent": 0.0,
"memory_percent": 0.0,
"disk_percent": 0.0,
"cpu_percent": round(cpu_percent, 1),
"memory_percent": round(memory_percent, 1),
"disk_percent": round(disk_percent, 1),
}
def queue(self) -> list[dict[str, Any]]: