已开启
[Bug]: MegaMoe Level1 在无 Git 元数据的 CI 目录中写入证据失败 #375
Feiran Zhang创建于  28 天前
Feiran Zhang
Feiran Zhang
28 天前 创建

🐛 Describe the bug

MegaMoe Level1 在 CI 的归档测试目录中完成计算和校验后,写入测试证据时执行 git rev-parse HEAD。该目录不含 Git 元数据,命令返回 128,导致 rank 0 退出失败。

受影响的两个场景为共享资源验证和原默认接口验证;其余 rank 已通过。公共证据采集位于 tests/torch/multicore/_mega_moe_utils.py。

最小复现:

import subprocess
import tempfile

with tempfile.TemporaryDirectory() as root:
    subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=root, text=True)

错误包含 fatal: not a git repository,并抛出 subprocess.CalledProcessError,退出码为 128。在 Git worktree 内执行时能够获取 SHA,因此通常不会触发该问题。

Expected behavior

源码 SHA 应作为可降级的辅助证据。没有 Git 仓库或 Git 不可用时,记录 source_sha: null 和失败原因,继续保留版本、文件哈希及各 rank 的验证结果。正常仓库仍应记录实际 SHA,其他证据采集错误和测试断言应正常报告。

Additional context

修复 PR:https://gitcode.com/mindspore/hyper-parallel/pull/1368

已使用真实 Git 命令复现原错误,并在模拟设备信息及 2/4 rank 汇总的证据写入回归中验证降级行为;这项回归不代表重新执行了 NPU ST。

Environment info

  • CI:Ascend910B,测试从不含 Git 元数据的归档目录运行。
  • 本地最小复现:cann920 环境中的 Python 3.10.19。
likedislike
Feiran ZhangFeiran Zhang
28 天前 添加了label:bug
庄昭雄庄昭雄
1 天前 关联了pull request:fix(tests): record the source sha as evidence instead of requiring it