Skip to content

[MP][Hotfix] add default implementation for report_status#2723

Merged
ApostaC merged 2 commits intoLMCache:devfrom
ApostaC:local-dev/nixl-report-status
Mar 10, 2026
Merged

[MP][Hotfix] add default implementation for report_status#2723
ApostaC merged 2 commits intoLMCache:devfrom
ApostaC:local-dev/nixl-report-status

Conversation

@ApostaC
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC commented Mar 9, 2026

What this PR does / why we need it:

The recently merged report_status subsystem (PR #2699) requires all L2 adapters to implement report_status(). This PR:

  1. Adds a proper report_status() implementation to NixlStoreL2Adapter, reporting health status, backend type, stored/pinned object counts, and pool utilization.
  2. Changes L2AdapterInterface.report_status() from an abstract method to a default implementation that returns is_healthy: True with an extra_warning field, so future L2 adapters won't crash if they haven't implemented it yet.

Special notes for your reviewers:

The default base class implementation includes "extra_warning": "report_status is not implemented and runs default impl" to signal to developers checking status output that a proper override is needed.

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

ApostaC added 2 commits March 9, 2026 23:41
Signed-off-by: ApostaC <yihua98@uchicago.edu>
Signed-off-by: ApostaC <yihua98@uchicago.edu>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a dependency issue arising from the recently merged report_status subsystem. It ensures that all L2 adapters can gracefully handle status reporting by providing a default implementation in the base interface and a specific, detailed implementation for the NixlStoreL2Adapter. This change prevents potential crashes and offers clearer insights into the health and state of the Nixl L2 adapter.

Highlights

  • Default report_status Implementation: The L2AdapterInterface.report_status() method was changed from an abstract method to a concrete method with a default implementation. This default returns is_healthy: True and includes an extra_warning field to indicate that a proper override is needed, preventing crashes for L2 adapters that haven't yet implemented it.
  • NixlStoreL2Adapter Status Reporting: A comprehensive report_status() implementation was added to NixlStoreL2Adapter. This implementation reports health status, backend type, stored and pinned object counts, pool utilization, and event loop activity.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • lmcache/v1/distributed/l2_adapters/base.py
    • Removed the @abstractmethod decorator from report_status.
    • Added a default implementation for report_status that returns is_healthy: True and an extra_warning.
  • lmcache/v1/distributed/l2_adapters/nixl_store_l2_adapter.py
    • Implemented the report_status method to provide detailed metrics including health, object counts, and pool status.
  • tests/v1/distributed/test_nixl_store_l2_adapter.py
    • Added a new test class TestReportStatus for NixlStoreL2Adapter.report_status().
    • Included tests to verify the shape and types of the status dictionary.
    • Added tests for the initial state of the adapter's status.
    • Implemented tests to check status changes after storing objects.
    • Added a test to confirm is_healthy becomes False after the adapter is closed.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable hotfix by providing a default implementation for L2AdapterInterface.report_status(), preventing crashes for adapters that haven't implemented it. The new implementation for NixlStoreL2Adapter is comprehensive and well-tested. My review includes a few suggestions to improve code clarity by removing a redundant field from the status report and to strengthen one of the new test assertions. Overall, this is a solid improvement.

"pinned_object_count": pinned_object_count,
"pool_size": self._config.pool_size,
"pool_free_slots": pool_free_slots,
"event_loop_alive": self._loop_thread.is_alive(),
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.

medium

The event_loop_alive field is redundant as its value is always the same as is_healthy. To simplify the status report, I suggest removing this field. This will also require updating the tests that check for this key.

assert isinstance(status["pinned_object_count"], int)
assert isinstance(status["pool_size"], int)
assert isinstance(status["pool_free_slots"], int)
assert isinstance(status["event_loop_alive"], bool)
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.

medium

This line checks for the event_loop_alive key. As this key is redundant with is_healthy, I've recommended its removal from the report_status output. If that change is made, this line should also be removed.

assert status["stored_object_count"] == 0
assert status["pinned_object_count"] == 0
assert status["pool_size"] == POOL_SIZE
assert status["pool_free_slots"] > 0
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.

medium

This assertion is correct but can be made stronger. For a newly initialized adapter under this test's configuration, the number of free slots should be equal to the pool size. I suggest changing this to assert status["pool_free_slots"] == status["pool_size"] for a more precise check.

Suggested change
assert status["pool_free_slots"] > 0
assert status["pool_free_slots"] == status["pool_size"]

assert status["pinned_object_count"] == 0
assert status["pool_size"] == POOL_SIZE
assert status["pool_free_slots"] > 0
assert status["event_loop_alive"] is True
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.

medium

This line checks for the event_loop_alive key. As this key is redundant with is_healthy, I've recommended its removal from the report_status output. If that change is made, this line should also be removed.

# Unhealthy after close
status = adpt.report_status()
assert status["is_healthy"] is False
assert status["event_loop_alive"] is False
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.

medium

This line checks for the event_loop_alive key. As this key is redundant with is_healthy, I've recommended its removal from the report_status output. If that change is made, this line should also be removed.

@ApostaC ApostaC added the full Run comprehensive tests on this PR label Mar 10, 2026
@YaoJiayi YaoJiayi self-requested a review March 10, 2026 00:20
@ApostaC ApostaC enabled auto-merge (squash) March 10, 2026 00:51
@ApostaC ApostaC merged commit 09b1f9e into LMCache:dev Mar 10, 2026
25 of 29 checks passed
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
* Hotfix: implement report_status for nixl storage

Signed-off-by: ApostaC <yihua98@uchicago.edu>
Signed-off-by: shaoxiawjc <wjc2800@163.com>
realAaronWu pushed a commit to realAaronWu/LMCache that referenced this pull request Mar 20, 2026
* Hotfix: implement report_status for nixl storage

Signed-off-by: ApostaC <yihua98@uchicago.edu>
Signed-off-by: Aaron Wu <aaron.wu@dell.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* Hotfix: implement report_status for nixl storage

Signed-off-by: ApostaC <yihua98@uchicago.edu>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* Hotfix: implement report_status for nixl storage

Signed-off-by: ApostaC <yihua98@uchicago.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants