Prhub

#26624 ci: allow /rerun-test to dispatch nightly/weekly CUDA tests

原始 PR 作者 alisonshao 合并时间 2026-05-30 16:35 文件变更 2 提交数 1 评论 7 代码增减 +136 / -58

执行摘要

允许 /rerun-test 调度 nightly/weekly CUDA 测试

修复环形 2.5-1T TP8 崩溃(#26623)时,发现未能直接在 PR 上重跑 nightly 测试,只能等待定时任务,导致修复验证周期长达 6-24 小时。该 PR 填补这一空白,提升开发者调试效率。

建议关注该 PR 的设计模式:通过映射表与共享解析函数保持配置单一事实源,降低 future 维护成本。适合作为 CI 脚本扩展的参考样例。

讨论亮点

PR 获得 maintainer Kangyan-Zhou 直接批准,无 review 评论或争议。Issue 评论中通过 /rerun-test 验证了两种场景:含映射的 nightly 测试(成功调度)和不含映射的 nightly-8-gpu-b200(初始失败,但在补充配置后成功)。

实现拆解

  1. 新增 legacy 套件解析函数 _extract_legacy_suites:模仿 _extract_runner_configs,从文件中提取所有单字符串 suite= 值。
  2. 定义套件到 runner_config 映射表 _LEGACY_SUITE_TO_RUNNER_CONFIG:将 nightly/weekly 套名硬编码映射到 scripts/ci/runner_configs.yml 中的 key(例如 nightly-8-gpu-common8-gpu-h200)。未在映射中的套件(如 nightly-8-gpu-b200、NPU/AMD 套件)保持不可调度并给出明确错误信息。
  3. 抽取共享调度函数 _resolve_runner_config_dispatch_err:新路径和 legacy 路径共用同一解析逻辑,确保 runner 详情(标签、安装脚本、超时、rdma)仍由 runner_configs.yml 唯一决定。
  4. 新增 runner 配置 8-gpu-b200:在 runner_configs.yml 中加入缺失的 entry,使 nightly-8-gpu-b200 可通过。
文件 模块 状态 重要度
scripts/ci/utils/slash_command_handler.py CI 脚本 modified 7.14
scripts/ci/runner_configs.yml CI 配置 modified 2.24

关键符号

_extract_legacy_suites _dispatch_err _resolve_runner_config

关键源码片段

scripts/ci/utils/slash_command_handler.py infrastructure

核心变更文件:新增 legacy 套件解析、映射表、共享调度函数,重构成新的解析路径。

# scripts/ci/utils/slash_command_handler.py ( 部分 )# Legacy nightly/weekly 测试套件使用单个字符串 `suite=` 注册,
# 没有 runner_config 元数据。这里将每个已知套件名映射到
# scripts/ci/runner_configs.yml 中的 runner_config key,
# 使得 /rerun-test 能获取 runner 详情(标签、安装脚本、超时等)。
_LEGACY_SUITE_TO_RUNNER_CONFIG = {
    "nightly-1-gpu": "1-gpu-large",
    "nightly-kernel-1-gpu": "1-gpu-large",
    "nightly-eval-text-2-gpu": "2-gpu-large",
    "nightly-perf-text-2-gpu": "2-gpu-large",
    "nightly-eval-vlm-2-gpu": "2-gpu-large",
    "nightly-perf-vlm-2-gpu": "2-gpu-large",
    "nightly-4-gpu": "4-gpu-h100",
    "nightly-4-gpu-b200": "4-gpu-b200",
    "nightly-8-gpu-common": "8-gpu-h200",
    "nightly-8-gpu-h200": "8-gpu-h200",
    "nightly-kernel-8-gpu-h200": "8-gpu-h200",
    "nightly-8-gpu-h20": "8-gpu-h20",
    "nightly-8-gpu-b200": "8-gpu-b200",
    "weekly-8-gpu-h200": "8-gpu-h200",
}
​
​
def _dispatch_err(suite, msg):
    """生成一个表示调度失败的结果字典,包含错误信息。"""
    return {
        "suite": suite,
        "runner_label": None,
        "install_script": "",
        "install_timeout": "",
        "rdma_devices": "",
        "is_cpu": False,
        "error": msg,
    }
​
​
def _resolve_runner_config(rc, full_path, suite):
    """将一个 runner_config key 解析为 detect_suite 使用的调度字典。
    成功返回调度字典,失败返回错误字典。
    """
    configs = _runner_configs.load()
    cfg = configs.get(rc)
    if cfg is None:
        known = ", ".join(f"`{k}`" for k in sorted(configs))
        return _dispatch_err(
            suite,
            f"Unknown runner_config `{rc}` in `{full_path}` — not in "
            f"scripts/ci/runner_configs.yml.\nKnown: {known}",
        )
    install_script = cfg["install"]
    if not _ALLOWED_INSTALL_SCRIPT.match(install_script):
        return _dispatch_err(
            suite,
            f"Disallowed install script `{install_script}` for runner_config `{rc}`",
        )
    # ... 其余逻辑(获取 timeout、rdma 等)
    from . import runner_configs as _runner_configs
    # 实际代码继续拼装结果字典并返回

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

映射表 _LEAGACY_SUITE_TO_RUNNER_CONFIG 与 nightly/weekly workflow YAML 中的硬件信息耦合,若 workflow 更新但映射未同步可能导致调度到错误硬件或失败。此外,硬编码映射需要手动维护,缺少自动校验。但当前映射已验证与 workflow 一致(见 body)。

开发者现在可以在 PR 上直接使用 /rerun-test 命令重跑 nightly/weekly 测试,显著缩短故障排查循环。对于 nightly-8-gpu-b200 等原不可调度的套件,已在新增 runner_configs.yml 项后变得可调度。非 CUDA 套件(NPU、AMD)保持不变,避免意外调度。

配置映射需同步 workflow 手动维护映射表 新增 runner config 需保证 YAML 正确

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论