Files
DCTS/docs/contributing.md
T
fmq 1bfa240cb0 feat(all): 源精度命名体系、工作流可观测台、节点停用管理与白名单归档
核心变更:

  1. GridAxisValue 源精度命名
     - 新增 GridAxisValue 类型,携带 f64 数值 + YAML 源书写文本(Deref 透明兼容算术)
     - config.rs 绕过 serde_yaml 归一化,逐 token 捕获轴值原文(logg: 5.0 → g5.0)
     - runner/executor/scheduler 全链路改用 DB TEXT 列权威 point_name,
       修复 REAL 列回读丢精度导致的 model_name 错配

  2. 工作流执行可观测台
     - 新增 stats/progress/points 三组 API(进度时间序列、经验速率 ETA、
       停滞预警、逐点明细分页、收敛性热力图数据)
     - 新增 workflow_progress_snapshots 表 + tasks/grid_points 耗时列
     - runner 携带 last_iter/worst_depth/n_depths 进 conv.json
     - 前端新增 hash 路由、工作流详情页(概览/网格点/收敛分析三 Tab)、YAML 编辑器

  3. 节点停用/启用管理
     - 新增 disabled 状态 + disable/enable API;停用节点保持心跳但停止分发,
       worker 空闲待命而非退出;移除 revoke API,token 失效统一走重发覆盖;
       移除 host_name 字段

  4. 白名单结果归档
     - 新增 result_filter 模块,只归档有语义产物,丢弃 Tlusty 中间单元(~2MB/模型)
     - executor 原子写入归档 + 200 点 LRU 上限

  5. 历史数据导入
     - sync_seeds 重写为 import_results:经 /admin/import_seed 标记 converged +
       按新版命名迁移产物树

  6. 部署与目录重规划
     - data/results→seeds、data/archive→result + migrate_data_dirs.sh
     - deploy.sh 增强(SSH 复用、Profile、远程 env);Dockerfile 瘦身

  7. 文档同步更新 api/database/architecture/deployment
2026-07-31 01:34:05 +08:00

2.4 KiB
Raw Blame History

DCTS 开发者与参与贡献指南 (Contributing Guide)

感谢关注并参与 DCTS (Distributed Computing TLUSTY/SYNSPEC) 的开发!本文档为开发者提供本地环境配置、代码库结构说明及测试规范。


1. 本地开发环境准备

必备依赖

  • Rust 工具链1.75+ (推荐使用 rustup 安装)
  • C/Fortran 编译器(计算节点模拟调试需 gfortran 或预编译好的二进制)
  • SQLite 3开发库(嵌入在 Rust dependencies 中,无需额外安装系统库)

克隆与编译

cd dcts
cargo check --workspace --all-targets
cargo build

2. 代码库结构 (Workspace Layout)

dcts/
├── Cargo.toml               # Workspace 根配置
├── config.yaml              # 示例网格配置文件
├── crates/
│   ├── common/              # [Library] 物理计算引擎、子进程管理、收敛检测与模板
│   ├── server/              # [Binary] Axum HTTP REST 服务端与 Scheduler
│   ├── node/                # [Binary] Worker 节点 Daemon 与任务抢占回路
│   └── mq/                  # [Library] SQLite 事务型分布式任务队列
├── tools/
│   └── import_results/      # [Binary] 历史计算结果导入工具(旧版网格结果 → 标记已完成 + 迁移产物树)
└── docs/                    # 分主题架构与规格技术文档

3. 测试与规范 (Testing & Guidelines)

3.1 运行单元测试与集成测试

# 运行 Workspace 内所有单元测试
cargo test --workspace

# 针对核心物理解析模块独立测试
cargo test -p common

3.2 代码风格与 Linting

提交 PR 前请确保以下命令无 error 和 warning

# 代码格式化
cargo fmt --all -- --check

# Rust 官方 Linter 静态检查
cargo clippy --workspace --all-targets -- -D warnings

4. 提交 Code Review 规范

  1. 分支策略:从 main 切出特性分支,推荐命名如 feature/seed-optimizerfix/stale-node-leak
  2. Commit Message 规范:格式推荐使用 module: succinct explanation,如:
    • common: add tolerance factor check for seed finder
    • server: fix sqlite connection pool leak under heavy load
  3. 保持文档更新:若修改了 API 接口定义或数据库 Schema,请同步更新 docs/api_reference.mddocs/database.md