已合并
【PR】: 完善脚本,增强健壮性。修复了4处文档中的路径错误 #1528
【PR】: 完善脚本,增强健壮性。修复了4处文档中的路径错误 #1528
已合并
zzq创建于 25 天前
zzq成员
25 天前

Pull Request

描述

完善脚本,增强健壮性。修复了4处文档中的路径错误。

变更类型

请选择本次引入的变更类型:

关联的Issue

如何测试

描述测试此变更的步骤和前提条件:
1.在CANNLab平台上执行没问题
2.

核对清单

其他信息

在此添加任何其他关于本次 PR 的说明。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zzq 的贡献)
Zzzq成员
25 天前 添加了label:enhancement
Zzzq成员
25 天前 创建了 pull request,commit 6cefc216
atomgit-bot
atomgit-bot
25 天前 评论:

变更摘要

本 PR 主要对 setup_torch_npu_daily.sh 环境安装脚本进行健壮性增强,包括新增 Python 版本参数格式校验以防止越界路径构造、为 pip install 补充 PyTorch CPU 额外索引源、以及增加安装成功提示。同时修复了 4 处文档中的路径错误。

主要改动

  • Python 版本参数格式校验:在 setup_torch_npu_daily.sh 中新增正则校验 ^[0-9]+\.[0-9]+\.[0-9]+$,当用户传入的 PYTHON_VERSION 不符合 x.y.z 格式时直接报错退出,避免通过非法参数构造越界路径。
  • pip install 增加 extra-index-url:为 Daily torch_npu Wheel 的安装命令添加 --extra-index-url https://download.pytorch.org/whl/cpu 参数,确保依赖解析时能正确获取 PyTorch CPU 版本的包索引。
  • 脚本执行成功提示:在脚本末尾新增 echo "SUCCESS: PyTorch 和 torch_npu 环境安装成功。",便于用户明确判断脚本是否完整执行成功。
  • 文档路径错误修复:修正了 4 处文档中的路径错误(涉及 4 个文档文件,具体路径细节未在补丁中展开)。
likedislike
atomgit-bot
atomgit-bot
25 天前 评论:

代码审查

经过对全部 5 个变更文件的逐一排查,我未发现本次 diff 引入的任何正确性、安全、可靠性或破坏性变更问题。以下是逐文件审查结论:


审查详情:

  1. scripts/env_install/pytorch/setup_torch_npu_daily.sh — 新增三处改动:

    • Python 版本格式校验(第 25-28 行):使用正则 ^[0-9]+\.[0-9]+\.[0-9]+$ 校验 $PYTHON_VERSION,有效阻止了通过非法参数构造越界路径(如 ../)的风险。正则写法正确,set -e 下校验失败会终止脚本。无问题。
    • pip install 增加 --extra-index-url(第 190-192 行):指向 PyTorch 官方 CPU wheel 仓库 https://download.pytorch.org/whl/cpu,用于正确解析 torch_npu daily 包的 torch 依赖。URL 使用 HTTPS,是 PyTorch 生态的标准做法。无问题。
    • 成功提示(第 194-195 行):在 set -e 保护下,仅在所有步骤成功后输出。无问题。
  2. autofuse/README.md(第 67 行)— 链接从 ./examples/README.md 修正为 ./examples/pytorch/README.md。旧文件不存在,新文件存在。修复有效。无问题。

  3. autofuse/README_en.md(第 81 行)— 链接从 ./examples/README.md 修正为 ./examples/pytorch/README_en.md。旧文件不存在,新文件存在。修复有效。无问题。

  4. docs/en/quick_install.md(第 123 行)— 链接从 ../../autofuse/examples/README_en.md 修正为 ../../autofuse/examples/pytorch/README_en.md。旧文件不存在,新文件存在。修复有效。无问题。

  5. docs/zh/quick_install.md(第 123 行)— 链接从 ../../autofuse/examples/README.md 修正为 ../../autofuse/examples/pytorch/README.md。旧文件不存在,新文件存在。修复有效。无问题。


总结:

  • P0:0
  • P1:0
  • P2:0
  • P3:0

整体风险判断:低风险。 本次变更均为正向改进——Shell 脚本增加了输入校验和依赖解析能力,增强了健壮性;4 处文档链接修复使原本 404 的路径指向了实际存在的文件。未发现回归风险或安全问题。

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
CANN-robotCANN-robot成员
25 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
25 天前 评论:

CLA Signature Pass

gcw_Xt6hqG9y, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
25 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here
You can get sig-info at here


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/graph-autofusion zhanj, xchu42, xuyafei (3/2) zhanj (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

gcw_Xt6hqG9y, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
25 天前 将yangyongqiang0606,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
25 天前 将yangyongqiang0606,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为审查人
Zzzq成员
25 天前 修改了pull request 的描述
zzq成员
25 天前 评论:

/compile

likedislike
Zzzq成员
25 天前 update merge request[project id: 8005834, iid: 1528, commit_id: d53d8a82ea430d0bf7ffee9616376293b6fb440f] virtual merging success
CANN-robotCANN-robot成员
25 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [c94075a5919748ba8f0ec4994559b635][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-07-28 09:58:08]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [dccdd0d6938c40f299b2d46a0a7d9669][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-07-28 10:03:59]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [a53d3d0a1cb64017bebd785b55317096][流水线指导]

任务名称状态日志下载链接
UT_Test_Python_superkernel ✅ SUCCESS >>>>>
ST_Test_Python_superkernel ✅ SUCCESS >>>>>
UT_Test_superkernel ✅ SUCCESS >>>>>
UT_Test_autofuse_framework ✅ SUCCESS >>>>>
ST_Test_autofuse_framework ✅ SUCCESS >>>>>
UT_Test_autofuse_ascendc_api ✅ SUCCESS >>>>>
ST_Test_autofuse_ascendc_api ✅ SUCCESS >>>>>
ST_Test_autofuse_e2e ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>

[2026-07-28 10:33:13]    CI执行结束

likedislike
CANN-robotCANN-robot成员
25 天前 删除了label:ci-pipeline-running
此处折叠了6条事件消息 查看更多
Zzzq成员
25 天前 修改了pull request 的描述
xchu42
xchu42成员
25 天前 评论:

/lgtm

likedislike
xuyafei成员
25 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
25 天前 添加了label:lgtm
Zzzq成员
25 天前 update merge request[project id: 8005834, iid: 1528, commit_id: 6973884af91e3c2359291132429441055bee72e9] virtual merging success
Zzzq成员
25 天前 强制推送  2 个提交:c6485d49-1 commit from branch developa227f026-完善脚本,增强健壮性。修复了4处文档中的路径错误
Zzzq成员
25 天前 update merge request[project id: 8005834, iid: 1528, commit_id: edc74bbae33c8e71b7fea13c7a1ef2869231a3cb] virtual merging success
CANN-robotCANN-robot成员
25 天前 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
25 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robot成员
25 天前 删除了label:lgtm
CANN-robot
CANN-robot成员
25 天前 评论:

Notice

New code changes of the pull request are detected and remove these labels lgtm. 😳

likedislike
zzq成员
25 天前 评论:

/compile

likedislike
Zzzq成员
25 天前 update merge request[project id: 8005834, iid: 1528, commit_id: b7d4dc528e6a4e20de347a407ea96ed14247fc2b] virtual merging success
CANN-robotCANN-robot成员
25 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [9161bcbb326042da809824a12597ba61][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-07-28 11:34:15]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [fb9498e793aa4e318bd4a3393c6954c7][流水线指导]

任务名称状态日志下载链接
UT_Test_Python_superkernel ✅ SUCCESS >>>>>
ST_Test_Python_superkernel ✅ SUCCESS >>>>>
UT_Test_superkernel ✅ SUCCESS >>>>>
UT_Test_autofuse_framework ✅ SUCCESS >>>>>
ST_Test_autofuse_framework ✅ SUCCESS >>>>>
UT_Test_autofuse_ascendc_api ✅ SUCCESS >>>>>
ST_Test_autofuse_ascendc_api ✅ SUCCESS >>>>>
ST_Test_autofuse_e2e ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>

[2026-07-28 11:49:39]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
25 天前 评论:

流水线任务触发成功
任务链接 [13a86fc04d764e438c5679a8a56be08a][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-07-28 11:41:39]    CI执行结束

likedislike
CANN-robotCANN-robot成员
25 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
25 天前 添加了label:ci-pipeline-passed
xuyafei成员
25 天前 评论:

/lgtm

likedislike
xchu42
xchu42成员
25 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
25 天前 添加了label:lgtm
zhanj
zhanj成员
24 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
24 天前 添加了label:approved
CANN-robotCANN-robot成员
24 天前 合入了pull request