Closed
[Requirement|需求建议]: 支持 Python 场景 STest 及 Examples 下所有任务混跑,提升 SMoke 任务执行性能 #196
杨旭Add on  Jan 24Closed at  Jan 26
杨旭
杨旭Collaborators
Jan 24 Create

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

当前 build_ci.py 在 Python 场景下配置 -e 和 -s参数时,会把 STest 和 Examples 任务拆分为 2个 pytest 调用的子任务执行。
这 2 个子任务内都存在执行耗时较长的 拖尾用例,拖尾过程中 NPU卡空闲,会拖慢执行耗时。

考虑支持 Python 场景下 STest 和 Examples 用例混跑(即汇总到一个 pytest 调用命令内),这样能够彼此掩盖拖尾,缩短任务总耗时;

Origin(信息来源)

PyPTO CIE 团队: @DCGDDD

Benefit / Necessity (价值/作用)

提升门禁 SMoke 任务效率,预计缩短 60 sec

Design(设计方案)

  1. 分析当前 build_ci.py 实现,当同时指定 -e 和 -s参数时,调用 pytest 的命令配置为 pytest examples python/tests/st;
  2. 针对 examples 目录和 python/tests 目录下均存在 conftest.py 的问题,需分析二者功能差异,实现收编到同一个 conftest.py 并将其放到项目根目录,注意需要兼容 ut场景;
  3. 针对 examples 目录下存在的 pytest.ini 文件,需考虑将其功能扩展收编至根目录 pytest.ini中,支持 stest, utest 使用 pytest 默认的文件和用例匹配规则,支持 examples/modules 路径下特殊的匹配规则;
likedislike
杨旭
杨旭Collaborators
Jan 24 Comments:

PyPTO CIE 团队自规划需求。

likedislike
杨旭杨旭Collaborators
Jan 24 Assign DCGDDD as responsible person
杨旭
杨旭Collaborators
Jan 24 Comments:

以 PR 636 验证任务分析收益如下:

  • 修改前:
    [2026/01/23 16:44:38.917 GMT+08:00] ================== 145 passed, 3 skipped in 75.85s (0:01:15) ===================
    [2026/01/23 16:44:38.917 GMT+08:00] 2026-01-23 16:44:38,611 - build_ci.py:1116 - INFO: pytest run success, Duration 76 secs Remain 336 secs
    ... ...
    [2026/01/23 16:46:11.308 GMT+08:00] =================== 9 passed, 16 skipped in 92.18s (0:01:32) ===================
    [2026/01/23 16:46:11.308 GMT+08:00] 2026-01-23 16:46:11,093 - build_ci.py:1116 - INFO: pytest run success, Duration 92 secs Remain 244 secs
    
    [2026/01/23 16:46:11.308 GMT+08:00] 2026-01-23 16:46:11,094 - build_ci.py:774 - INFO: Build[CI] Finish, Duration 177 secs.
    
  • 修改后
    [2026/01/24 16:15:08.773 GMT+08:00] ================= 154 passed, 19 skipped in 100.48s (0:01:40) ==================
    [2026/01/24 16:15:08.773 GMT+08:00] 2026-01-24 16:15:08,088 - build_ci.py:1125 - INFO: pytest run success, Duration 100 secs Remain 312 secs
    [2026/01/24 16:15:08.773 GMT+08:00] 2026-01-24 16:15:08,089 - build_ci.py:777 - INFO: Build[CI] Finish, Duration 109 secs.
    

收益统计

  1. 用例数在优化前后可对齐;
  2. 执行耗时由 177 secs 优化至 109 secs,收益 68 sec,提升 62%;
likedislike
杨旭杨旭Collaborators
Jan 26 changed custom state from 进行中 to 已完成
杨旭杨旭Collaborators
Jan 26 Close issue
杨旭杨旭Collaborators
Jan 26 associated Kanban: PyPTO
杨旭杨旭Collaborators
Jan 26 Added label: infrastructure
CANN-robotCANN-robotCollaborators
Mar 20 Added label: resolved