Prhub

#47085 [ROCm][CI] Make tests/v1/shutdown an importable package

原始 PR 作者 peizhang56 合并时间 2026-06-30 10:01 文件变更 1 提交数 1 评论 0 代码增减 +0 / -0

执行摘要

修复 ROCm 上 spawn 子进程导入失败

ROCm CI 中 Distributed Torchrun + Shutdown Tests (2 GPUs) 步骤失败,原因为子进程因缺少 __init__.py 无法导入 test_delete 模块。PR body 明确指出:"The spawn child re-imports the test via f.__module__. Because tests/v1/shutdown/ had no __init__.py, pytest collected the file under the bare module name test_delete instead of tests.v1.shutdown.test_delete, so the child interpreter — which only has the repo root on its path — could not import it."

该 PR 改动极小但定位精准,值得快速合入。对于使用 spawn_new_process_for_each_test 装饰器的其他测试目录,可检查是否也缺少 __init__.py 以防止类似问题。

讨论亮点

无 review 讨论(仅 Claude 自动评论和 AndreasKaratzas 的 LGTM 批准)。

实现拆解

  1. 添加缺失的 __init__.py:在 tests/v1/shutdown/ 目录下创建空文件 __init__.py(0 行变动,新增文件)。
  2. 无其他代码变更:无需修改测试逻辑或配置,仅通过包结构调整修复导入问题。
  3. 验证:在 AMD MI300 上执行完整测试套件,之前失败的用例 test_llm_delete_inprocess 通过,其余 18 个通过、1 个失败(无关的门控模型权限问题)。
文件 模块 状态 重要度
tests/v1/shutdown/__init__.py 测试 added 3.51

分析完成后,这里会展示 LLM 生成的相对完整源码片段和详细注释。

评论区精华

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

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

风险与影响

极低风险:仅添加一个空文件,不影响任何现有逻辑。需确保该目录下的其他测试文件也遵循包导入规范(已确认使用 from tests.v1.shutdown.utils import ... 导入兄弟模块)。

  • 用户:无直接用户影响。
  • 系统:修复 ROCm CI 的 Distributed Torchrun + Shutdown Tests (2 GPUs) 步骤,减少 CI 不稳定。
  • 团队:减少 ROCm 维护者的排查负担。
极低风险

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论