feat(all): 数据库模块化拆分与版本化迁移、任务引擎命名体系收敛、物理输出校验加固与用户配置接通
- server/db: 拆 4929 行 db.rs 单体为 db/ 目录,migrations.rs 引入 PRAGMA user_version
版本化迁移运行器(M1~M13)
- 任务引擎 Phase 6/7b/7c 改名收敛:EngineStageConfig→PhaseConfig、StagePolicy→ResumePolicy、
Converged→Completed、删除 task_type 列、success_method 拆 tlusty_/synspec_ 双列、
新增 tlusty_status/synspec_status 半失败阶段守卫
- 科学正确性加固:conv_check 任意行 NaN/Inf/溢出判无效(0 行容忍)、新增 spec_is_valid
校验 SYNSPEC 脏谱、itek_history 逐次迭代全量保真、fmt_abn powf 溢出饱和
- 用户配置真正接通:tlusty_chain/tlusty_input 由死字段经 调度器→TaskSpec→executor→runner
透传生效;config 加载期 validate + deny_unknown_fields + 解析失败记 warn
- 调度修复:H1 活锁(pending_strategies 跳过已失败策略)、种子查找错误不再静默降级冷启动
- dashboard: 阶段配置面板 tlusty_stage/synspec_stage、"已完成"标签、迭代诊断展示
- docs: 新增 database_refactor_design.md,同步 database/api/PIPELINE/workflow_detail
This commit is contained in:
+43
-38
@@ -110,32 +110,32 @@
|
||||
pub task_id: Uuid,
|
||||
pub point_name: String,
|
||||
pub params: GridPointParams,
|
||||
pub task_type: TaskType, // ColdRun | SeedStep(兼容字段 = strategies[0])
|
||||
pub seed_point_name: Option<String>, // 步进种子点名称(如适用)
|
||||
pub timeout_sec: u64,
|
||||
pub workflow_name: Option<String>, // 多工作流分区键
|
||||
pub wave: i32, // 难度波次
|
||||
pub tlusty_config: EngineStageConfig, // TLUSTY 阶段配置(enabled/policy/strategies)
|
||||
pub synspec_config: EngineStageConfig, // SYNSPEC 阶段配置
|
||||
pub tlusty_config: PhaseConfig, // TLUSTY 阶段配置(enabled/policy/strategies)
|
||||
pub synspec_config: PhaseConfig, // SYNSPEC 阶段配置
|
||||
pub synspec_params: Option<serde_json::Value>, // SYNSPEC 数值参数(波长范围等)
|
||||
pub atmosphere_ref: Option<String>, // 显式大气来源点(仅 SYNSPEC-only 场景)
|
||||
}
|
||||
```
|
||||
|
||||
`EngineStageConfig`(阶段独立配置,见 `task_engine_decoupling_design.md §3`):
|
||||
`PhaseConfig`(阶段独立配置,见 `task_engine_decoupling_design.md §3`;Phase 7b 由 `EngineStageConfig` 改名):
|
||||
```rust
|
||||
pub struct EngineStageConfig {
|
||||
pub struct PhaseConfig {
|
||||
pub enabled: bool,
|
||||
pub policy: String, // skip_converged | force_recompute | skip_failed
|
||||
pub policy: ResumePolicy, // skip_converged | force_recompute | skip_failed
|
||||
pub strategies: Vec<String>, // 策略链:["cold_run","seed_step"],失败回退弹首项
|
||||
}
|
||||
```
|
||||
|
||||
- **TypeScript 类型声明**:
|
||||
```typescript
|
||||
export type TaskType = 'cold_run' | 'seed_step';
|
||||
> Phase 6 起 **无 `task_type` 字段**——执行链由 `tlusty_config.strategies[0]` 派生。
|
||||
> 旧 payload 若仍携带 `task_type` 键会被 serde 忽略(未知字段)。
|
||||
|
||||
export interface EngineStageConfig {
|
||||
- **TypeScript 类型声明**(Phase 6 起无 `task_type`):
|
||||
```typescript
|
||||
export interface PhaseConfig {
|
||||
enabled: boolean;
|
||||
policy: string;
|
||||
strategies: string[];
|
||||
@@ -145,13 +145,12 @@
|
||||
task_id: string;
|
||||
point_name: string;
|
||||
params: GridPointParams;
|
||||
task_type: TaskType;
|
||||
seed_point_name?: string | null;
|
||||
timeout_sec: number;
|
||||
workflow_name?: string | null;
|
||||
wave: number;
|
||||
tlusty_config: EngineStageConfig;
|
||||
synspec_config: EngineStageConfig;
|
||||
tlusty_config: PhaseConfig;
|
||||
synspec_config: PhaseConfig;
|
||||
synspec_params?: Record<string, unknown> | null;
|
||||
atmosphere_ref?: string | null;
|
||||
}
|
||||
@@ -172,7 +171,7 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
pub params: Option<GridPointParams>,
|
||||
pub node_id: String,
|
||||
pub status: TaskStatus, // Pending | Running | Completed | Failed | Timeout
|
||||
pub converged: bool,
|
||||
pub result_valid: bool, // 7b 改名(原 converged):本次结果是否可用(大气收敛/管线成功双义)
|
||||
pub max_relc: Option<f64>,
|
||||
pub atmosphere_has_nan: bool,
|
||||
pub elapsed_sec: f64,
|
||||
@@ -202,7 +201,7 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
params?: GridPointParams;
|
||||
node_id: string;
|
||||
status: TaskStatus;
|
||||
converged: boolean;
|
||||
result_valid: boolean; // 7b 改名(原 converged)
|
||||
max_relc?: number | null;
|
||||
atmosphere_has_nan: boolean;
|
||||
elapsed_sec: number;
|
||||
@@ -311,11 +310,12 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
|
||||
export interface WorkflowListStats {
|
||||
total: number;
|
||||
converged: number;
|
||||
completed: number; // 7c:由 converged 改名(状态值 'completed')
|
||||
failed: number;
|
||||
running: number;
|
||||
cold_run_converged: number;
|
||||
seed_step_converged: number;
|
||||
synspec_converged: number;
|
||||
}
|
||||
|
||||
export interface WorkflowItem {
|
||||
@@ -550,9 +550,10 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"logn": -2.0,
|
||||
"logo": -2.0
|
||||
},
|
||||
"task_type": "cold_run",
|
||||
"seed_point_name": null,
|
||||
"timeout_sec": 7200
|
||||
"timeout_sec": 7200,
|
||||
"tlusty_config": { "enabled": true, "policy": "skip_converged", "strategies": ["cold_run", "seed_step"] },
|
||||
"synspec_config": { "enabled": true, "policy": "skip_converged", "strategies": ["standard"] }
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -656,7 +657,7 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
- **请求格式**: `multipart/form-data`
|
||||
- Part `report`: 旧版 `conv.json` 的**原文 JSON**(映射为 `ModelSummary`,服务端解析出 `name` / `params` / `converged` / `final_max_relc`)
|
||||
- Part `seed_file`: 二进制数据(`.7` 大气种子文件;收敛点必传)
|
||||
- Part `success_method` *(可选)*: 文本 `cold_run` / `seed_step`。由 `tools/import_results` 依据旧 `conv.json` 的 stages 是否含 `seed_nc` 判定后设置,决定导入点最终归因(缺省按 seed_step 统计)
|
||||
- Part `tlusty_success_method` *(可选)*: 文本 `cold_run` / `seed_step`。由 `tools/import_results` 依据旧 `conv.json` 的 stages 是否含 `seed_nc` 判定后设置,写入导入点大气归因 `tlusty_success_method`(缺省按 seed_step 统计)
|
||||
- **Query 参数**: `workflow`(可选,默认 `imported`):目标工作流名,种子导入到该工作流的 `grid_points`。
|
||||
- **命名保真**: `point_name` 取旧 `conv.json` 的 `name` 字段(源精度真名,如 `t20000_g5.0_...`),**逐字符**落库(磁盘目录、`grid_points.name`、`seeds.point_name`),与旧版 Python `gen_input5.model_name` 完全一致。
|
||||
- **幂等**: `ON CONFLICT DO NOTHING` upsert `grid_points`、`conv.json` 与 `.7` 原子覆盖写,可重复运行。
|
||||
@@ -810,10 +811,11 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"pending": 210,
|
||||
"queued": 60,
|
||||
"running": 32,
|
||||
"converged": 260,
|
||||
"completed": 260,
|
||||
"failed": 10,
|
||||
"cold_run_converged": 200,
|
||||
"seed_step_converged": 60
|
||||
"seed_step_converged": 60,
|
||||
"synspec_converged": 245
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1101,12 +1103,12 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"pending": 120,
|
||||
"queued": 40,
|
||||
"running": 8,
|
||||
"converged": 261,
|
||||
"completed": 261,
|
||||
"failed": 3,
|
||||
"cold_run_converged": 220,
|
||||
"seed_step_converged": 41,
|
||||
"waves": [
|
||||
{ "wave": 0, "total": 108, "converged": 108, "failed": 0 }
|
||||
{ "wave": 0, "total": 108, "completed": 108, "failed": 0 }
|
||||
],
|
||||
"avg_point_sec": 740.5,
|
||||
"eta_sec": 9620.0
|
||||
@@ -1114,10 +1116,10 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
}
|
||||
```
|
||||
> 收敛手段归因仅 `cold_run_converged` / `seed_step_converged` 两字段;**无独立
|
||||
> `imported_converged`**——历史导入点统一按 seed_step 途径计入(`success_method` 语义见 §8.8)。
|
||||
> `imported_converged`**——历史导入点统一按 seed_step 途径计入(大气归因 `tlusty_success_method` 语义见 §8.8)。
|
||||
> `avg_point_sec` = `AVG(COALESCE(tasks.elapsed_sec, created_at→completed_at 时间戳差))`——
|
||||
> 优先用 Worker 回报的精确墙钟(不含排队等待),历史无 `elapsed_sec` 的行回退时间戳差近似;
|
||||
> `eta_sec` = `avg_point_sec × (total - converged - failed) ÷ 在线节点总槽位`(并发感知;
|
||||
> `eta_sec` = `avg_point_sec × (total - completed - failed) ÷ 在线节点总槽位`(并发感知;
|
||||
> 无在线节点按串行兜底);无历史数据时二者为 `null`。
|
||||
|
||||
---
|
||||
@@ -1132,8 +1134,8 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
|
||||
| 参数 | 取值 | 默认 |
|
||||
| :--- | :--- | :--- |
|
||||
| `status` | `pending`/`queued`/`running`/`converged`/`failed` | 不过滤 |
|
||||
| `method` | `cold_run`/`seed_step`(白名单**不含** `imported`,传入即 `400`) | 不过滤 |
|
||||
| `status` | `pending`/`queued`/`running`/`completed`/`failed`(旧值 `converged` 仍作兼容别名接受,服务端归一化为 `completed`) | 不过滤 |
|
||||
| `method` | `cold_run`/`seed_step`(映射 `tlusty_success_method`)`synspec_only`(光谱专用点:`tlusty_success_method IS NULL AND synspec_success_method IS NOT NULL`)。白名单**不含** `imported`,传入即 `400` | 不过滤 |
|
||||
| `wave` | 整数波次 | 不过滤 |
|
||||
| `q` | 点名子串(LIKE 通配符已转义) | 不过滤 |
|
||||
| `sort` | `wave`/`teff`/`max_relc`/`attempts`/`last_completed_at` | `wave` |
|
||||
@@ -1154,11 +1156,11 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"teff": 60000.0, "logg": 5.0, "loghe": -2.0,
|
||||
"logc": -4.0, "logn": -4.0, "logo": -4.0,
|
||||
"cno_sum": -12.0, "wave": 0,
|
||||
"status": "converged",
|
||||
"success_method": "seed_step",
|
||||
"status": "completed",
|
||||
"tlusty_success_method": "seed_step",
|
||||
"synspec_success_method": "standard",
|
||||
"attempt_count": 2,
|
||||
"last_max_relc": 0.00043,
|
||||
"last_task_type": "seed_step",
|
||||
"seed_point_name": "t60000_g5.0_he2_c-4_n-4_o-4",
|
||||
"node_id": "node-a1b2",
|
||||
"last_completed_at": "2026-07-30 11:12:00",
|
||||
@@ -1190,7 +1192,6 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"attempts": [
|
||||
{
|
||||
"task_id": "uuid",
|
||||
"task_type": "cold_run",
|
||||
"seed_point_name": null,
|
||||
"status": "failed",
|
||||
"max_relc": 954000.0,
|
||||
@@ -1198,9 +1199,12 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"node_id": "node-a1b2",
|
||||
"error_message": "nl stage diverged",
|
||||
"created_at": "2026-07-30 09:00:00",
|
||||
"completed_at": "2026-07-30 09:30:00"
|
||||
"completed_at": "2026-07-30 09:30:00",
|
||||
"elapsed_sec": 1800.0,
|
||||
"failed_stage": "tlusty",
|
||||
"summary_json": "{... ModelSummary ...}"
|
||||
},
|
||||
{ "task_type": "seed_step", "status": "completed", "...": "第二次尝试(救回)" }
|
||||
{ "seed_point_name": "t60000_...", "status": "completed", "failed_stage": null, "...": "第二次尝试(救回)" }
|
||||
],
|
||||
"conv": {
|
||||
"converged": true,
|
||||
@@ -1242,7 +1246,7 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"hours": 24,
|
||||
"series": [
|
||||
{ "ts": "2026-07-31 08:00:00", "total": 432, "pending": 120, "queued": 40,
|
||||
"running": 8, "converged": 261, "failed": 3 }
|
||||
"running": 8, "completed": 261, "failed": 3 }
|
||||
],
|
||||
"rate_per_hour": 12.5,
|
||||
"now": "2026-07-31T09:00:00Z",
|
||||
@@ -1253,9 +1257,9 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
}
|
||||
```
|
||||
> `series` 超 300 条自动降采样(首末点保留);`rate_per_hour` = 窗口首末
|
||||
> converged 增量 ÷ 时长(快照不足 2 条为 null);`now` = 服务端当前 UTC 时刻(前端锚定曲线右缘);
|
||||
> completed 增量 ÷ 时长(快照不足 2 条为 null);`now` = 服务端当前 UTC 时刻(前端锚定曲线右缘);
|
||||
> `done_rate_per_hour` = 终态完成速率(用于 ETA);`rate_span_hours` = 速率统计实际时间跨度;
|
||||
> `stalled_minutes` = 终态数(converged+failed)最后一次增长至窗口末端的分钟数(前端 >10 分钟触发停滞预警)。
|
||||
> `stalled_minutes` = 终态数(completed+failed)最后一次增长至窗口末端的分钟数(前端 >10 分钟触发停滞预警)。
|
||||
|
||||
---
|
||||
|
||||
@@ -1277,11 +1281,12 @@ Worker 节点向服务端上报的任务计算结果。
|
||||
"updated_at": "2026-07-30 11:00:00",
|
||||
"stats": {
|
||||
"total": 432,
|
||||
"converged": 261,
|
||||
"completed": 261,
|
||||
"failed": 3,
|
||||
"running": 8,
|
||||
"cold_run_converged": 220,
|
||||
"seed_step_converged": 41
|
||||
"seed_step_converged": 41,
|
||||
"synspec_converged": 248
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user