e728dcd226
① D11 HTML 报告 RustFS 单源化(TECH_DEBT P2 清偿):可视化产物写任务临时目录后
裸传报告键 html/reports/{filename}(文件名寻址),/html StaticFiles 挂载删除,
新增 html_report_router 根路径代理(报告键→遗留 JSON 包装→本地卷兜底→404,
防穿越);URL 形状 /html/{filename} 不变,持久化引用零迁移;celery 摘除
html_data 卷,镜像不再烤入陈旧报告;顺带删除 get_stp_file_with_data 死数据块
② OCC 方案 B(D10 清偿):run_occ(op_name, payload) 契约 + 常驻工作进程池
(occ_process_pool + occ_worker 操作注册表),超时/崩溃 terminate 换新补位、
任务级超时 recover 整体重建,残留线程泄漏根治;TopoDS 不跨进程(generate_cavity
分模 + 方案 STEP 持久化全在子进程内,返回 export_manifest);删除内存形状缓存链、
CADExporter.export_mold_results、shape_loader(→ stp_materializer)
③ OCC 方案 A 部署参数:CELERY_CONCURRENCY / CELERY_MAX_TASKS_PER_CHILD 进
Dockerfile.celery + compose + .env.example
④ D2 诚实标注:铝价响应带 source: "simulated",前端按来源渲染标注(原硬编码
"上海期货交易所"属虚假声明),死代码 getAluminumPrice 删除
⑤ CI 门禁:.gitea/workflows/ci.yml 三 job(pytest / 前端构建含 vue-tsc /
openapi 漂移检测)
接口变更三件套随批完成(openapi 76→77 paths + gen:api + 前端构建通过;方案 B
接口面零变化)。测试基线 143 passed, 0 skipped(新增 16 项)。文档六处同步。
Co-Authored-By: Claude Code <noreply@anthropic.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""
|
||
unified 入口 — 同时挂载 moldinsight + inventory,供前端同域反代统一访问
|
||
"""
|
||
import os, sys
|
||
from pathlib import Path
|
||
|
||
src_root = Path(__file__).parent.parent
|
||
sys.path.insert(0, str(src_root))
|
||
|
||
os.chdir(Path(__file__).parent.parent.parent)
|
||
|
||
from shared.app_factory import create_app
|
||
|
||
|
||
def _register_routers(app):
|
||
"""注册 unified 业务路由"""
|
||
try:
|
||
from moldinsight.api import router as moldinsight_router
|
||
app.include_router(moldinsight_router, prefix="/api")
|
||
except Exception as e:
|
||
print(f"[WARN] MoldInsight 路由: {e}")
|
||
|
||
# D11:HTML 报告代理挂根路径,URL 形状与原 StaticFiles 保持一致(/html/{filename})
|
||
try:
|
||
from moldinsight.api.html_report_router import include_into as include_html_report
|
||
include_html_report(app)
|
||
except Exception as e:
|
||
print(f"[WARN] HTML 报告路由: {e}")
|
||
|
||
try:
|
||
from inventory.api import inventory_router
|
||
app.include_router(inventory_router)
|
||
except Exception as e:
|
||
print(f"[WARN] Inventory 路由: {e}")
|
||
|
||
|
||
app = create_app(
|
||
title="Gemold - Unified Backend",
|
||
service_name="unified",
|
||
connect_rustfs=True,
|
||
serve_frontend_static=False,
|
||
register_routers=_register_routers,
|
||
)
|