Skip to content

fix: 性能测试 — 修复进度条卡在0%、中止任务误报崩溃、增加 Tokenizer Path 字段 - #1520

Merged
Yunnglin merged 8 commits into
modelscope:mainfrom
duxingx1a:fix/perf-progress-stop-tokenizer
Jul 27, 2026
Merged

Yunnglin merged 8 commits into
modelscope:mainfrom
duxingx1a:fix/perf-progress-stop-tokenizer

Conversation

@duxingx1a

@duxingx1a duxingx1a commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

修复内容

1. 进度条永远卡在 0%

根因: ProgressTracker 被创建但 run_multi_benchmark 从未调用 update()。
修复: 每完成一组 benchmark sweep 后调用 ProgressTracker.get_current().update(1)。(perf/main.py)

2. 用户中止任务显示为"子进程崩溃"

根因: /stop → proc.terminate() → run_in_subprocess 检测到 exit code -15 → 500 错误。
修复: 新增 TaskStoppedError 区分主动停止和真正崩溃;蓝图层返回 {status: 'stopped'} 而非 500。(service/utils/process.py + blueprints/perf.py)

3. 后端崩溃后前端仍显示 "Running..."

根因: 进度轮询只看 percent >= 100,不检查 status: 'error'。
修复: 轮询回调增加对 status === 'error' / 'completed' 的检测。(web/.../TaskRunnerPage.tsx)

4. random 数据集缺少 tokenizer 路径输入框

根因: random 数据集强制要求 --tokenizer-path,但 Web UI 无对应输入框。
修复: 新增"更多参数"折叠区,内含 Tokenizer Path 字段。(web/.../PerfConfigForm.tsx)


修改文件

文件 说明
evalscope/perf/main.py 调用 ProgressTracker.update()
evalscope/service/utils/process.py 新增 TaskStoppedError + _user_stopped_tasks
evalscope/service/utils/__init__.py 导出 TaskStoppedError
evalscope/service/blueprints/perf.py 捕获 TaskStoppedError 返回 200
evalscope/web/src/components/perf/PerfConfigForm.tsx "更多参数"折叠 + Tokenizer Path
evalscope/web/src/components/tasks/TaskRunnerPage.tsx 进度轮询检测 error/completed
evalscope/web/src/i18n/translations/perf.ts 新增 i18n key

测试

  • ✅ 官方 CLI 启动,Web UI 提交 perf 任务
  • ✅ 进度条正常更新(20% → 100%)
  • ✅ 错误时前端自动停轮询
  • ✅ 中止任务不报 500
  • ✅ Tokenizer Path 展开/提交正常

…ath field

- ProgressTracker.update() was never called — add call after each benchmark
  sweep so the web UI progress bar advances beyond 0%.
- User-initiated stop (via /stop) raised a misleading 'Subprocess terminated
  unexpectedly (exit code -15)' RuntimeError.  Introduce TaskStoppedError to
  distinguish intentional termination from a real crash, and return HTTP 200
  instead of 500.
- Frontend progress polling only checked percent >= 100 — also check
  status: 'error'/'completed' so the UI stops polling when the backend
  finishes or crashes.
- Add Tokenizer Path field (hidden behind 'More Parameters' toggle) to
  PerfConfigForm, fixing 'Tokenizer path is required' error when using
  the random dataset.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@duxingx1a duxingx1a changed the title Fix/perf progress stop tokenizer fix: 性能测试 — 修复进度条卡在0%、中止任务误报崩溃、增加 Tokenizer Path 字段 Jul 25, 2026
Yunnglin added 5 commits July 27, 2026 11:28
…op detection

- Remove per-sweep tracker.update(1): request-level updates already flow
  through TqdmLogging(track_progress=True); the extra +1 double-counted
  (empirically 101/100 = 101%).
- Mark task as user-stopped BEFORE terminate() to close the race with the
  parent poll loop in run_in_subprocess.
- Also honour the user-stop marker when the child converts SIGTERM into an
  error result; consume the marker once to avoid leaks.
…status; drop drive-by change

- Catch TaskStoppedError in eval _execute_task so stopping an eval task
  returns {status: 'stopped'} instead of a 500, mirroring the perf blueprint.
- Declare the optional 'status' field on progressResponseSchema and drop the
  Record cast in TaskRunnerPage (schema is the source of truth).
- Revert the unrelated model_dump(exclude_none=True) change in data_utils
  (out of scope for this PR; propose separately with rationale).
- Add tests/service/test_process_stop.py covering graceful stop vs crash.
…PerfConfigForm

tokenizer_path has no validator, so the MORE_PARAMS_IDS auto-expand branch
was unreachable; re-introduce it together with the first validated field
inside the collapsible section.
…ral completion

- stop_process: only mark user-stopped when actually terminating a live
  child; stopping an already-exited process is a no-op returning False.
- run_in_subprocess: drain the result queue before consulting the user-stop
  marker so a produced result always wins; this also unifies the duplicated
  error-result handling.
- Add a regression test for stop-after-natural-exit.
@Yunnglin

Copy link
Copy Markdown
Collaborator

感谢贡献!#2/#3/#4 三个问题确认真实存在,修复思路正确,已保留。

另外以 maintainer 身份在分支上追加了几个 commit:

  • 删除了组级 tracker.update(1):进度卡 0% 已由 Fix async event loop and task lifecycle #1507 修复(请求级更新已生效),叠加会导致重复计数(实测 101/100);
  • 加固停止检测:标记前置修竞态、SIGTERM 转 error 路径识别、自然完成的结果优先不被 stopped 屏蔽;eval 蓝图也对称捕获 TaskStoppedError;
  • 还原了与本 PR 无关的 data_utils.py 改动(如需要请单独提 PR),清理死代码,补充 tests/service/test_process_stop.py,merge 最新 main。

CI 全绿,准备合入。

@Yunnglin Yunnglin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 问题 #2/#3/#4 的修复经验证有效,其余问题已通过后续 commit 修正(见 comment),CI 全绿。

@Yunnglin
Yunnglin merged commit 8da8d5c into modelscope:main Jul 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants