[XPU] fix interrupt_requests for mix#7741
[XPU] fix interrupt_requests for mix#7741cmcamdy wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
CI报告基于以下代码生成(30分钟更新一次): 1 任务总览存在 1 个 Required 任务失败(
2 任务状态汇总2.1 Required任务 : 1/9 通过
2.2 可选任务 — 21/25 通过
3 失败详情(仅 required)Approval — 代码规范(置信度: 高)Approval
根因详情: 关键日志: 修复建议:
修复建议摘要: 请 xyxinyang 或 zyyzghb 审批本PR的日志行为变更 关联变更: PR在XPU interrupt_requests处理逻辑中新增了logger.info和logger.error日志调用 |
| req_ids = task.get("req_ids", []) | ||
| logger.info(f"Processing interrupt_requests for req_ids: {req_ids}") | ||
| try: | ||
| abort_result = self.engine._control_abort_requests( |
There was a problem hiding this comment.
_control_abort_requests这个函数很快就会废弃了,建议参照https://github.com/PaddlePaddle/FastDeploy/blob/release/online/20251131/fastdeploy/splitwise/internal_adapter_utils.py 修改
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-07 20:07:49
📋 Review 摘要
PR 概述:在 PD 分离 mix 模式下,为 _recv_external_module_control_instruct 补充缺失的 interrupt_requests 控制命令处理分支。
变更范围:fastdeploy/splitwise/internal_adapter_utils.py
影响面 Tag:[PD Disaggregation] [XPU]
📝 PR 规范检查
PR 标题 [XPU] tag 对应的是 XPU 硬件特定文件(xpu_worker.py 等),而本次变更文件位于 fastdeploy/splitwise/,根据架构文档映射为 [PD Disaggregation] 影响面,Tag 与实际变更模块不完全匹配;且 PR 描述各章节均为模板占位符,需补充完整。
标题建议(可直接复制):
[BugFix] fix interrupt_requests handler in splitwise internal adapter for XPU mix mode
PR 描述建议(可直接复制,必须复刻 checklist §D2 模板的完整结构):
## Motivation
在 PD 分离(mix mode)的 XPU 场景中,`internal_adapter_utils.py` 缺少对 `interrupt_requests` 控制命令的处理分支,导致外部模块发送请求中断指令时无法被正确执行和回复。
## Modifications
- `fastdeploy/splitwise/internal_adapter_utils.py`:在 `_recv_external_module_control_instruct` 方法中新增 `interrupt_requests` 命令处理分支,通过调用 `engine._control_abort_requests` 执行请求中断,并将执行结果通过 `recv_control_cmd_server.response_for_control_cmd` 回复给调用方;异常情况下捕获错误并记录日志后仍回复错误信息。
## Usage or Command
N/A
## Accuracy Tests
N/A
## Checklist
- [x] Add at least a tag in the PR title.
- Tag list: [`[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]`]
- You can add new tags based on the PR content, but the semantics must be clear.
- [x] Format your code, run `pre-commit` before commit.
- [ ] Add unit tests. Please write the reason in this PR if no unit tests.
- [ ] Provide accuracy results.
- [ ] If the current PR is submitting to the `release` branch, make sure the PR has been submitted to the `develop` branch, then cherry-pick it to the `release` branch with the `[Cherry-Pick]` PR tag.问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | fastdeploy/splitwise/internal_adapter_utils.py:112 |
用 type() 动态构造伪 ControlRequest 对象,建议改用项目已有的正式 ControlRequest 类 |
总体评价
功能补全思路正确,异常处理和日志完善。主要建议是将 type() 动态构造方式替换为项目正式的 ControlRequest 类,代码更清晰且与其他调用处保持一致;PR 描述需补充完整。
| logger.info(f"Processing interrupt_requests for req_ids: {req_ids}") | ||
| try: | ||
| abort_result = self.engine._control_abort_requests( | ||
| type("ControlRequest", (), {"get_args": lambda _: {"req_ids": req_ids}})() |
There was a problem hiding this comment.
🟡 建议 用 type() 动态构造伪 ControlRequest 对象是一种 hack 写法,不易维护。
项目中已有正式的 ControlRequest 类(fastdeploy/engine/request.py),建议直接使用:
from fastdeploy.engine.request import ControlRequest
abort_result = self.engine._control_abort_requests(
ControlRequest(
request_id=task_id_str,
method="interrupt_requests",
args={"req_ids": req_ids}
)
)这样代码更清晰可读,且与其他调用处(如 api_server.py 中 abort_requests 的实现方式)保持一致。
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7741 +/- ##
==========================================
Coverage ? 71.60%
==========================================
Files ? 396
Lines ? 55581
Branches ? 8689
==========================================
Hits ? 39799
Misses ? 13043
Partials ? 2739
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
Modifications
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.