已合并
在FileManager.read_json_file和read_csv_file函数中解释文件无法读取的原因 #5455
zhangyin_gitcode创建于 2025年10月3日
在FileManager.read_json_file和read_csv_file函数中解释文件无法读取的原因 #5455
已合并
zhangyin_gitcode创建于 2025年10月3日
zhangyin_gitcode
zhangyin_gitcode
2025年10月3日

PR 合入模板

注:经过自检不涉及的可标注“不涉及”或直接打勾,特殊情况请文字备注。不符合规范的 PR 不允许合入,请(后备)commit 注意。


1. 修改描述

  • 修改原因:

FileManager.read_json_file和read_csv_file函数在读取出错时,没有解释原因,只是提示“Failed to read the file:”,其行为与read_yaml_file和read_common_file函数不一致。后两者通过reason is {str(e)}给出了出错的原因。

这些原因对于使用者定位可能的错误非常重要。

  • 修改内容:

FileManager.read_json_file和read_csv_file函数中,异常处理部分,均修改为类似如下的形式:

f"Failed to read the file: {base_name}, reason is {str(e)}"

2. 功能验证


3. 分支合并要求


3. 代码检视

  • 要求:

    • 合入代码超过 200 行,需三人以上会议检视。
    • 检视密度≥1个/100行。
    • 检视缺陷密度未达要求需提供说明。
    • 大于 1000 行代码原则上不允许合入,需进行备案。
  • 检视意见数:____ 条 (请填写本次检视的意见总数,用于commit合入前审视)


4. 安全自检

Python、C++:

C++:


5. 变更知会


likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 zhangyin_gitcode 的贡献)
zhangyin_gitcodezhangyin_gitcode
2025年10月3日 创建了 pull request,commit c7eac878
ascend-robot
ascend-robot成员
2025年10月3日 评论:

Thank your for your pull-request.

The full list of commands accepted by me can be found at here.

You can get sig-info guidance at here

likedislike
ascend-robotascend-robot成员
2025年10月3日 添加了label:ascend-cla/no
zhangyin_gitcode
zhangyin_gitcode
2025年10月3日 评论:

/check-cla

likedislike
ascend-robotascend-robot成员
2025年10月3日 删除了label:ascend-cla/no
ascend-robotascend-robot成员
2025年10月3日 添加了label:ascend-cla/yes
zhangyin_gitcode
zhangyin_gitcode
2025年10月3日 评论:

/compile

likedislike
zhangyin_gitcode
zhangyin_gitcode
2025年10月3日 评论:

compile

likedislike
AtlasAccount
AtlasAccount成员
2025年10月3日 评论:

✅ 流水线任务触发成功,正在执行,请稍候。 任务链接[912a43040c4e4e18b1c49f42910e17aa]

likedislike
fanglanyue
fanglanyue成员
2025年10月17日 评论:

compile

likedislike
AtlasAccount
AtlasAccount成员
2025年10月17日 评论:

✅ 流水线任务触发成功,正在执行,请稍候。 任务链接[501e1ac18dc1479483ff3b030cc427da]

likedislike
AtlasAccountAtlasAccount成员
2025年10月17日 添加了label:ci-pipeline-running
zhangyin_gitcodezhangyin_gitcode
2025年10月21日 预合并成功(commit_id: 4b31fd66c2c48db7a6a5eff2096465b963953420)
zhangyin_gitcodezhangyin_gitcode
2025年10月21日 强制推送  29 个提交:63b2cee6-28 commits from branch master,5f3e896b-在FileManager.read_json_file和read_csv_file函数中解释文件无法读取的原因
zhangyin_gitcodezhangyin_gitcode
2025年10月21日 预合并成功(commit_id: 5dd4b5911a920c49f3f60c40375fb678a9fc19bc)
ascend-robot
ascend-robot成员
2025年10月21日 评论:

以下是根据您提交的修改文件推荐的Reviewer和Committer序列,需各模块评审通过后方可合入

Module List Reviewers Committers
profiler/msprof_analyze Seanesmhxocism, eejiechu chenhao_1209, xhahn77, aerfaliang
likedislike
ascend-robot
ascend-robot成员
2025年10月21日 评论:

CLA Signature Pass

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

likedislike
fanglanyue
fanglanyue成员
2025年10月23日 评论:

compile

likedislike
AtlasAccount
AtlasAccount成员
2025年10月23日 评论:

✅ 流水线任务触发成功,正在执行,请稍候。 任务链接[898ec19804ba4ce799295463da402ee4]

likedislike
AtlasAccountAtlasAccount成员
2025年10月23日 删除了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
2025年10月23日 添加了label:ci-pipeline-passed
fanglanyue
fanglanyue成员
2025年10月23日 评论:

compile

likedislike
AtlasAccount
AtlasAccount成员
2025年10月23日 评论:

✅ 流水线任务触发成功,正在执行,请稍候。 任务链接[ebc3a94f26c44368bc4e35ec32637bf4]

likedislike
AtlasAccountAtlasAccount成员
2025年10月23日 删除了label:ci-pipeline-passed
AtlasAccountAtlasAccount成员
2025年10月23日 添加了label:ci-pipeline-passed
AtlasAccount
AtlasAccount成员
2025年10月23日 评论:
检查项 状态 详情 出包
sca ✅ >>> N/A
anti_poison ✅ >>> N/A
ptdbg_ut ✅ >>> N/A
ST ✅ >>> N/A
code_check ✅ >>> N/A
likedislike
xfeng
xfeng
2025年10月23日 评论:

/lgtm

likedislike
WangJie
WangJie成员
2025年10月23日 评论:

/lgtm

likedislike
wangzixuan成员2025年10月23日进行代码检视2
profiler/msprof_analyze/prof_common/file_manager.py
@@ -69,3 +69,3 @@
6969 result_data.append(row_data)
7070 except Exception as e:
71- msg = f"Failed to read the file: {file_path}"
71+ msg = f"Failed to read the file: {file_path}, reason is {str(e)}"
wangzixuan2025年10月23日评论:

[review] 这里的file_path和上面的base_name是否有经过路径校验,非法字符校验。确保没有相关转义字符等内容,否则建议使用%r打印,避免相关的转义字符被错误处理。

likedislike
zhangyin_gitcode
zhangyin_gitcode
2025年10月23日 评论:

这里使用了该文件现有代码中read_yaml_file函数(96行)和read_common_file函数(112行)相同的处理方法。由于现有代码没有做相关处理,所以这里也没有做处理。

wangzixuan成员
2025年10月23日 评论:

/lgtm

likedislike
ascend-robotascend-robot成员
2025年10月23日 添加了label:lgtm
chenhao_1209成员
2025年10月23日 评论:

/approve

likedislike
ascend-robotascend-robot成员
2025年10月23日 添加了label:approved
ascend-robot
ascend-robot成员
2025年10月23日 评论:

Review Guide

This Pull-Request Passes Review.
Committers who writed a comment of /approve are: chenhao_1209.
Reviewers who writed a comment of /lgtm are: eejiechu, Seanesmhxocism, chenhao_1209.

likedislike
ascend-robotascend-robot成员
2025年10月23日 合入了pull request,合并节点 SHA:2534331d491652b693461c679803c2cacde06286
fanglanyuefanglanyue成员
2025年10月23日 关联了issue:[Bug-Report|缺陷反馈]: FileManager.read_json_file和read_csv_file函数在读取出错时,没有解释原因