-
Notifications
You must be signed in to change notification settings - Fork 54
Use AsyncLlamaStackClientHolder for /readiness endpoint. #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe health endpoint module and its associated unit tests were refactored to support asynchronous operations. Key functions and their tests were updated to use async/await syntax, and synchronous client mocks were replaced with asynchronous mocks. These changes ensure that provider health checks and readiness probes operate asynchronously throughout the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant AsyncLlamaStackClient
Client->>API: GET /readiness
API->>AsyncLlamaStackClient: await providers.list()
AsyncLlamaStackClient-->>API: List of providers
API-->>Client: ReadinessResponse (async)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code Graph Analysis (2)src/app/endpoints/health.py (2)
tests/unit/app/endpoints/test_health.py (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
ldjebran
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tisnik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
When multiple successive requests to
/readinessare made in quick succession the endpoint fails.It is plausible this is an issue with
llama-stack'sLlamaStackAsLibraryClientclass.Whilst it appears to be synchronous it's internal implementation uses
AsyncLlamaStackAsLibraryClient.This PR contains a workaround by using
AsyncLlamaStackClientHolder().Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing
The problem can be replicated with this code snippet:
Summary by CodeRabbit
Refactor
Tests