Pull Request已成功合入, 合并人@CANN-robot
(感谢 duhua 的贡献)变更摘要
此 PR 调整了 FindPythonCustomOpEntryInEnv 函数中对不可访问路径的处理逻辑:仅当路径是 Python 文件时才报错并返回失败;对于非 Python 文件(如 .so 共享库),改为跳过并记录警告,避免因非必要路径不可访问而导致整个加载流程失败。对应的单元测试也做了同步更新,验证缺失的非 Python 路径被优雅跳过而非触发错误。
主要改动
FindPythonCustomOpEntryInEnv中不可访问路径的处理策略调整:在stat()调用失败后,新增IsPythonFile判断分支;若路径是 Python 文件则保持原有GELOGE报错并返回FAILED的行为,若为非 Python 文件则改为GELOGW警告并continue跳过该路径。- 单元测试用例重命名与断言更新:将
check_need_load_python_custom_ops_fails_for_missing_non_python_path重命名为check_need_load_python_custom_ops_skips_missing_non_python_path,并将CheckNeedLoadPythonCustomOps的期望返回值从FAILED改为SUCCESS,以匹配新的跳过行为。


代码审查
结束总结
审查结果
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 0 |
(上述 P3 条目为确认无缺陷的信息性记录,非实际问题。)
逐文件确认
-
runtime/custom_op/python_custom_op_bridge_loader.cc:已审查。FindPythonCustomOpEntryInEnv中stat()失败分支的行为变更逻辑正确:.py后缀路径仍返回FAILED,非 Python 后缀路径(如.so)通过GELOGW+continue跳过。IsPythonFile函数仅检查后缀字符串,在stat失败后调用用于区分路径类型,语义合理。调用方CheckNeedLoadPythonCustomOps和LoadPythonCustomOpsIfNeeded均能正确处理新的返回值(SUCCESS+need_load=false)。未发现逻辑错误、安全漏洞或资源泄漏。 -
tests/ge/st/testcase/test_custom_op.cc:已审查。测试用例check_need_load_python_custom_ops_skips_missing_non_python_path(原fails_for_missing_non_python_path)的更新与新的跳过行为完全一致:缺失的.so文件路径不再导致FAILED,而是返回SUCCESS且need_load=false。ScopedEnvVarForCustomOpSt和ScopedTempDirForCustomOpSt的 RAII 析构顺序正确。无其他测试受此变更影响。
整体风险评估
低风险。此变更是对 ASCEND_CUSTOM_OPP_PATH 中非 Python 路径(如 .so 文件)不存在时的行为放宽:从硬错误改为静默跳过。变更范围局限于 FindPythonCustomOpEntryInEnv 函数及其唯一调用方 CheckNeedLoadPythonCustomOps,且测试已同步更新。.py 后缀路径的缺失仍会触发错误,保持了关键路径的严格性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


compile


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/ge | ✅ zhanj, kobemini (2/2) | ✅ zhanj (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


流水线任务触发成功
任务链接 [4c969c811df446a28ba5f625e1ce5553][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_X86_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_dflow | ✅ SUCCESS | ||
| UT_Test_ge_common | ✅ SUCCESS | ||
| UT_Test_parser | ✅ SUCCESS | ||
| UT_Test_python | ✅ SUCCESS | >>>>> | |
| UT_Test_rt | ✅ SUCCESS | ||
| UT_Test_acl | ✅ SUCCESS | ||
| UT_Test_autofuse | ✅ SUCCESS | ||
| UT_Test_executor | ✅ SUCCESS | ||
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_dflow | ✅ SUCCESS | ||
| ST_Test_ge_common | ✅ SUCCESS | ||
| ST_Test_parser | ✅ SUCCESS | ||
| ST_Test_python | ✅ SUCCESS | >>>>> | |
| ST_Test_rt | ✅ SUCCESS | ||
| ST_Test_autofuse | ✅ SUCCESS | ||
| ST_Test_executor | ✅ SUCCESS | ||
| ST_Test_hetero | ✅ SUCCESS | ||
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | ||
| ST_Test_autofuse_e2e | ✅ SUCCESS | ||
| UT_Test_fe | ✅ SUCCESS | ||
| UT_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_fe | ✅ SUCCESS | ||
| ST_Test_tefusion | ✅ SUCCESS | ||
| ST_Test_ge_common_atc | ✅ SUCCESS | ||
| UT_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_graphengine | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_executor_c | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_ge_autofuse | ✅ SUCCESS | >>>>> | |
| UT_Test_Report_fe | ✅ SUCCESS | >>>>> | |
| ST_Test_Report_fe | ✅ SUCCESS | >>>>> |
[2026-07-27 10:09:38] CI执行结束


流水线任务触发成功
任务链接 [170829d4dc9241bfbec7fff1660cc696][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_ARM_compiler | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_executor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_dflow | ✅ SUCCESS | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-27 10:01:47] CI执行结束


流水线任务触发成功
任务链接 [3e8889b56b8e47a3993cf4a48f611257][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck_Pr | ✅ SUCCESS | ||
| antipoison | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| codecheck_dt | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-07-27 10:00:04] CI执行结束


/lgtm


/lgtm


/approve


Pull Request
描述
修复 Python 自定义算子入口扫描时对
ASCEND_CUSTOM_OPP_PATH中不可访问路径的一刀切失败处理:.py文件时,打印 ERROR 日志并返回FAILED,明确暴露 Python 自定义算子入口缺失问题.so等非 Python 自定义算子路径影响 Python 自定义算子加载判断变更类型
请选择本次引入的变更类型:
关联的Issue
无
如何测试
git diff --check -- runtime/custom_op/python_custom_op_bridge_loader.cc tests/ge/st/testcase/test_custom_op.cccmake --build cmake-build-debug --target graph_engine_test -j8cmake-build-debug/tests/ge/st/testcase/graph_engine_test --gtest_filter="CustomOpFactoryStTest.load_python_custom_ops_if_needed_fails_for_missing_python_file:CustomOpFactoryStTest.check_need_load_python_custom_ops_skips_missing_non_python_path" --gtest_output=xml:/tmp/custom_op_loader_missing_path.xml核对清单
feat:,fix:)其他信息
PR 仅涉及 Python custom-op loader 对不可访问路径的分类处理,以及对应 ST 期望更新。