Skip to content

Reprobe once for health request - #4703

Merged
lvhan028 merged 2 commits into
InternLM:mainfrom
RunningLeon:patch-refresh-health
Jul 2, 2026
Merged

Reprobe once for health request#4703
lvhan028 merged 2 commits into
InternLM:mainfrom
RunningLeon:patch-refresh-health

Conversation

@RunningLeon

@RunningLeon RunningLeon commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Reprobe once if the cached state is unhealthy

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@RunningLeon
RunningLeon marked this pull request as ready for review June 26, 2026 06:46
Copilot AI review requested due to automatic review settings June 26, 2026 06:47
@RunningLeon RunningLeon changed the title [WIP]: Reprobe once if unhealty Reprobe once for health request Jun 26, 2026
@RunningLeon
RunningLeon requested a review from lvhan028 June 26, 2026 06:49

Copilot AI 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.

Pull request overview

This PR updates LMDeploy’s server health behavior so the /health endpoint can proactively refresh a cached unhealthy snapshot by triggering a new backend health probe, and adds unit tests for the new monitor and endpoint behavior.

Changes:

  • Added EngineHealthMonitor.refresh_snapshot() and serialized probing via an internal asyncio lock.
  • Updated the OpenAI API server /health route to refresh the snapshot when the cached status is not healthy/sleeping.
  • Introduced new unit tests covering snapshot refresh, probe serialization, and /health refresh behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lmdeploy/serve/core/health.py Adds probe serialization and a refresh_snapshot() helper to update/return the cached health snapshot.
lmdeploy/serve/openai/api_server.py Updates /health endpoint to optionally refresh cached health state before responding.
tests/test_lmdeploy/serve/test_health_monitor.py Adds unit tests validating refreshed unhealthy snapshots, serialized probes, and refreshed /health responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lmdeploy/serve/openai/api_server.py
Comment thread tests/test_lmdeploy/serve/test_health_monitor.py Outdated
@lvhan028 lvhan028 added the Bug:P1 label Jul 2, 2026
@lvhan028
lvhan028 merged commit 1a1d4fd into InternLM:main Jul 2, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants