提升暴雨产图效率

This commit is contained in:
wzy-warehouse
2026-06-21 14:52:23 +08:00
parent 5169ed2f33
commit 3e0f5a94cb
47 changed files with 513 additions and 188 deletions
+4 -4
View File
@@ -16,21 +16,21 @@ logger = get_logger("api")
@asynccontextmanager
async def lifespan(app: FastAPI):
"""应用生命周期:启动时预加载模型"""
"""应用生命周期:启动时预加载 DBN 模型"""
logger.info("正在预加载DBN模型...")
get_rainfall_model()
get_earthquake_model()
logger.info("DBN模型预加载完成")
# 检测 QGIS 子进程环境
# 检测 QGIS 子进程环境(产图时按需启动子进程)
qgis_root = getattr(settings, "QGIS_ROOT", None)
if qgis_root:
try:
from app.services.qgis.qgis_env import is_qgis_available
if is_qgis_available(qgis_root):
logger.info("QGIS 环境检测通过(子进程模式)")
logger.info("QGIS 环境检测通过")
else:
logger.warning("QGIS 环境不可用(未找到 Python 3.12 解释器),专题图功能降级")
logger.warning("QGIS 环境不可用,专题图功能降级")
except Exception as e:
logger.error(f"QGIS 环境检测失败: {e}")