fix(backtest): 结果页指标全显"—" + 任务重启后404
两个根因:
1. relative_metrics 缺字段(routes.py): get_result 的 relative_fields 列表
漏了 total_return/annual_return/sharpe_ratio/max_drawdown 4 个字段, 导致
这 4 个指标永远进不了响应 → 前端 MetricCards 显"—"。补全为 11 字段。
2. 任务 task_id 不持久(runner/cta_engine): submit_cta 用 cta_{symbol}_{id(params)}
(内存地址) 作 runner id, 而 run_cta_backtest 内部另生成 cta_{uuid} 存 DB,
两者持久层不相交 → 重启后 pool 内存映射丢失, get_result(runner_id) 的
load_result_by_task_id 查不到 → /result 404 → 前端指标全 0 + 图表无数据。
改为 submit 前置生成稳定 uuid, 透传给 run_cta_backtest 复用, 使
runner-id == DB task_id (单一 id, 重启可查)。
附: Dashboard 最近任务"策略/因子"列 min-width 150→190(长策略名不再截断)
测试: test_runner task_id 断言同步新格式
This commit is contained in:
@@ -108,7 +108,7 @@ function statusLabel(s: string): string {
|
||||
<el-table-column label="类型" width="84">
|
||||
<template #default="{ row }"><span class="chip" :class="`chip-${row.type}`">{{ typeLabel(row.type) }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="strategy" label="策略 / 因子" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="strategy" label="策略 / 因子" min-width="190" show-overflow-tooltip />
|
||||
<el-table-column prop="symbol" label="标的" width="90" />
|
||||
<el-table-column label="状态" width="84">
|
||||
<template #default="{ row }"><span class="chip" :class="`st-${row.status}`">{{ statusLabel(row.status) }}</span></template>
|
||||
|
||||
Reference in New Issue
Block a user