Skip to content

[Cherry-Pick][RL] Allow configuring update weights timeout (#8073)#8074

Merged
liyonghua0910 merged 1 commit into
PaddlePaddle:release/2.6from
jackyYang6:jacky/cp-update-weights-timeout-release-2.6
Jun 24, 2026
Merged

[Cherry-Pick][RL] Allow configuring update weights timeout (#8073)#8074
liyonghua0910 merged 1 commit into
PaddlePaddle:release/2.6from
jackyYang6:jacky/cp-update-weights-timeout-release-2.6

Conversation

@jackyYang6

Copy link
Copy Markdown
Contributor

Motivation

Support configuring the timeout for update_weights requests. This helps large weight updates avoid timing out with the fixed default timeout.

Modifications

  • Add timeout parameter validation in the OpenAI API update_weights endpoint.
  • Use the configured timeout when updating worker weights and cache-transfer metadata.
  • Keep timeout as a control-only parameter and do not forward it to workers.
  • Add unit tests for default timeout, custom timeout, and invalid timeout values.

Usage or Command

Example request body:

{
  "timeout": 120
}

If timeout is not provided, the default value is 180 seconds.

Accuracy Tests

Not applicable. This PR only changes control request timeout handling and does not affect model outputs.

Checklist

  • Add at least a tag in the PR title.
    • Suggested title: [Engine][APIServer] Allow configuring update weights timeout
  • Format your code, run pre-commit before commit.
  • Add 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.

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Paddle-CI-Agent | pr_review | 2026-06-24 13:37:18

📋 Review 摘要

PR 概述:为 OpenAI update_weights 增加 timeout 参数校验,并在 Engine/Cache 更新权重时使用该超时。
变更范围fastdeploy/entrypoints/openai/api_server.pyfastdeploy/engine/common_engine.py 及相关单测
影响面 TagAPIServer Engine

问题

级别 文件 概述
🔴 Bug fastdeploy/entrypoints/openai/api_server.py:486 timeout 大于 600 秒时仍会被 EngineClient.run_control_method 固定 600 秒提前截断,配置不会真正生效

📝 PR 规范检查

PR 描述结构符合模板;标题包含 [Cherry-Pick] 和官方 Tag,本轮未基于上下文确认原 develop PR 号。

总体评价

核心路径已正确避免把 timeout 透传给 worker/cache-transfer,但 API 入口到 engine 的等待超时仍未联动,导致大于 600 秒的配置场景会返回超时错误,需要修复后再合入。

status_code=400,
content={"error": "Invalid parameter value", "message": "timeout must be positive"},
)
args["timeout"] = request_data["timeout"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Bug 这里允许用户把 timeout 配成任意正整数,但当前请求链路里 EngineClient.run_control_method() 仍固定 asyncio.wait_for(..., timeout=600)

当用户为大权重更新配置 timeout > 600 时,engine 内部会继续按该值等待 worker/cache-transfer,但 OpenAI API 侧会在 600 秒先返回 Timeout waiting for control method response,配置的超时没有真正生效,甚至可能出现 HTTP 已失败而后台仍在更新权重的状态。

建议修复方式:
在发送 ControlRequest 后,让 EngineClient.run_control_methodupdate_weights 使用 request.args["timeout"] 派生的等待时间(建议加少量 buffer,例如 timeout + 10,或 max(600, timeout + 10)),并补一个覆盖 timeout > 600 的 engine_client/API 单测。

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/2.6@8be4aab). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.6    #8074   +/-   ##
==============================================
  Coverage               ?   71.60%           
==============================================
  Files                  ?      386           
  Lines                  ?    55773           
  Branches               ?     8762           
==============================================
  Hits                   ?    39937           
  Misses                 ?    13021           
  Partials               ?     2815           
Flag Coverage Δ
GPU 71.60% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mitu626 mitu626 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@jackyYang6 jackyYang6 changed the title [Cherry-Pick][RL] Allow configuring update weights timeout [Cherry-Pick][RL] Allow configuring update weights timeout(#8073) Jun 24, 2026
@liyonghua0910 liyonghua0910 changed the title [Cherry-Pick][RL] Allow configuring update weights timeout(#8073) [Cherry-Pick][RL] Allow configuring update weights timeout (#8073) Jun 24, 2026
@liyonghua0910
liyonghua0910 merged commit 1ca7c95 into PaddlePaddle:release/2.6 Jun 24, 2026
34 of 38 checks passed
@jackyYang6
jackyYang6 deleted the jacky/cp-update-weights-timeout-release-2.6 branch June 25, 2026 09:18
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.

5 participants