[Feature] Refactor /v1/abort_requests Endpoint#7615
[Feature] Refactor /v1/abort_requests Endpoint#7615qwes5s5 wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
d3667cf to
8f86bd1
Compare
8f86bd1 to
9f4caa1
Compare
9f4caa1 to
f504627
Compare
f504627 to
008186d
Compare
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-24 20:48:11
📋 Review 摘要
PR 概述:将 /v1/abort_requests 端点从同步阻塞模式重构为异步 fire-and-forget 模式,同时提取 _resolve_abort_targets / _build_abort_results 两个辅助方法,删除 _wait_abort_complete。
变更范围:entrypoints/(api_server、engine_client、router)、engine/common_engine.py、scheduler/local_scheduler.py
影响面 Tag:APIServer Engine Scheduler
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🔴 Bug | local_scheduler.py:136 |
ids_read_cursor 在删除末尾元素时越界 |
| 🔴 兼容性 | api_server.py:500 |
/v1/abort_requests 响应格式破坏性变更 |
| 🟡 建议 | engine_client.py:1142 |
abort_reqs() 无参调用时 engine 侧 KeyError 风险 |
| 🟡 建议 | router.py:600 |
_forward_abort 无超时,挂起连接将永驻 _background_tasks |
总体评价
重构方向正确,异步化可以避免接口阻塞;response_processors.py 中对空 token_ids 的防御性修复也是必要的。但 _recycle 的游标越界是真实的运行时崩溃风险,响应格式变更会静默破坏现有客户端,需要在合并前处理。
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7615 +/- ##
==========================================
Coverage ? 71.66%
==========================================
Files ? 419
Lines ? 57804
Branches ? 9064
==========================================
Hits ? 41424
Misses ? 13554
Partials ? 2826
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation
Currently, the /v1/abort_requests endpoint is synchronous, blocking the response until all target requests have been processed.
Modifications
Refactor this endpoint to an asynchronous model: it should return a response immediately upon receipt, offloading the actual interruption logic and result handling to the backend engine.
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.