-
Notifications
You must be signed in to change notification settings - Fork 161
fix(BA-1459): Broken list_presets
API, and SDK
#4541
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
ListResourcePresetsAction
ListResourcePresetsAction
ListResourcePresetsAction
list_presets
API, and SDK
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.
Pull Request Overview
This PR ensures the legacy etcd resource slots are loaded before streaming presets and records the fix in the changelog.
- Preload resource slots via
get_resource_slots()
inlist_presets
- Add changelog entry for the fix
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/ai/backend/manager/services/resource_preset/service.py | Invoke get_resource_slots() prior to streaming presets |
changes/4541.fix.md | Add changelog entry for the list_presets API and SDK fix |
Comments suppressed due to low confidence (1)
src/ai/backend/manager/services/resource_preset/service.py:182
- No tests were added to cover the new
get_resource_slots()
call or verify the behavior of loading presets; consider adding unit or integration tests for this path.
async def list_presets(self, action: ListResourcePresetsAction) -> ListResourceP
changes/4541.fix.md
Outdated
@@ -0,0 +1 @@ | |||
Fix broken `list_presets` API, and SDK |
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.
[nitpick] Remove the comma before 'and SDK' for clearer grammar: Fix broken
list_presets API and SDK
.
Copilot uses AI. Check for mistakes.
@@ -182,6 +182,7 @@ async def list_presets(self, action: ListResourcePresetsAction) -> ListResourceP | |||
) | |||
query = query.where(query_condition) | |||
presets = [] | |||
await self._config_provider.legacy_etcd_config_loader.get_resource_slots() |
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.
This function relies on side effects, making its behavior invisible from the outside.
(It is passed via contextvar.)
However, since this part was originally written this way in the existing code, I left it as is for now.
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.
Ah… this kind of code shouldn’t exist.
Fundamentally, there should be no code that accesses and updates a contextvar from another file.
Backported-from: main (25.8) Backported-to: 25.6 Backport-of: 4541
Backport to 24.09 is failed. Please backport manually. |
resolves #4524 (BA-1459)
Tested manually.
Example code
Result
Checklist: (if applicable)