已开启
fix: remove continue that made failed-json cleanup unreachable #136
fix: remove continue that made failed-json cleanup unreachable #136
已开启
NUAA_wqy创建于 28 天前
NUAA_wqy
NUAA_wqy
28 天前

描述

In gen_output_json.py the branch for a missing opc output json called
continue before the *_failed.json cleanup and the

aise FileNotFoundError(), so those five lines never executed. The
build then only printed [ERROR] and continued, exiting 0 with a failed
kernel (red error text but a green CI pipeline). Removing the
continue lets the cleanup and the intended raise run, failing the
build as the code clearly intended.

变更类型

关联的Issue

Fixes #60

测试

已完成的测试用例和场景:

  1. 本地验证通过,具体方法见上方描述与 commit message
  2. 改动最小且聚焦于该 Issue,不涉及其他逻辑

补充的UT用例:见 commit message / 描述中的验证说明(如仓内新增测试文件,已随本 MR 一并提交)

文档更新

NA

合入检查

likedislike
合并受阻
NUAA_wqyNUAA_wqy
28 天前 创建了 pull request,commit 5ce84692
NUAA_wqyNUAA_wqy
28 天前 关联了issue:[L2] gen_output_json.py:continue 之后的 _failed.json 清理与 raise FileNotFoundError 永不执行(缺 json 只打日志不失败)
atomgit-bot
atomgit-bot
28 天前 评论:

变更摘要

本 PR 修复 scripts/kernel/binary_script/gen_output_json.py 中缺失 OPC 输出 JSON 分支的控制流问题:该分支在打印 [ERROR] 提示后首先执行 continue,导致其后针对 *_failed.json 的清理逻辑以及 raise FileNotFoundError() 永远无法到达。删除该 continue 后,清理与预期抛错得以执行,使构建在 kernel 失败时以非零状态退出,而非仅打印红色错误文本却仍返回成功。改动最小且聚焦于该 Issue。

主要改动

  • 移除提前跳过的 continue: 在 generate_operator_json_content 中删除缺失 OPC 输出 JSON 分支里的 continue,使该分支不再直接结束当前迭代。
  • 恢复 *_failed.json 清理逻辑: 由于不再提前跳出,后续基于 opc_json_file_name + "_failed" 拼接并判断 os.path.exists(failed_json_file) 的失败 JSON 清理代码得以执行。
  • 恢复 raise FileNotFoundError() 触发: 原本被 continue 遮挡的抛错语句重新可达,使 kernel 失败时构建能按代码意图报错退出,避免出现 CI 假绿。
likedislike
不准确?
atomgit-bot
atomgit-bot
28 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
28 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
28 天前 评论:

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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
repo-cann/ops-ras ❌ (0/2)(You can also ask: 冯彤, 陈兴宇, yue-ma, 王林木, 周奇龙) ❌ (0/1)(You can also ask: 王林木, 唐燕峰, 於欣洁, 周奇龙, yue-ma)

💡 Tip:

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

CLA Signature Pass

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

likedislike
NUAA_wqy
NUAA_wqy
12 天前 评论:

/compile

likedislike
NUAA_wqy
NUAA_wqy
12 天前 评论:

/compile

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

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
API_Check ✅ SUCCESS >>>>>

[2026-10-21 18:30:31]    CI执行结束

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

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

任务名称状态日志下载链接
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-10-21 18:29:20]    CI执行结束

likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
12 天前 删除了label:api-check-pass
CANN-robot
CANN-robot成员
12 天前 评论:

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

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-10-21 18:36:21]    CI执行结束

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