-
Notifications
You must be signed in to change notification settings - Fork 164
refactor(BA-4011): Remove TODOs in manager/api/resource.py
#8219
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
base: main
Are you sure you want to change the base?
Conversation
60465ae to
9d8efc9
Compare
manager/api/resource.py
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
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
changes/8219.enhance.md
Outdated
| @@ -0,0 +1 @@ | |||
| For resource handler file in manager api, remove TODos with implementation No newline at end of file | |||
Copilot
AI
Jan 22, 2026
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 news fragment doesn’t follow the repository guideline of being a single well-formed English sentence (see changes/README.md:30), and it contains typos (e.g., TODos). Please rephrase to a clear one-liner (imperative form) and fix spelling/capitalization.
| For resource handler file in manager api, remove TODos with implementation | |
| Implement all remaining TODOs in the resource handler file in the Manager API. |
| } | ||
| }, | ||
| "required": [ | ||
| "scaling_group", |
Copilot
AI
Jan 22, 2026
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.
The OpenAPI schema marks scaling_group as required, but check-presets has historically accepted requests without it (the client SDK omits it when unset). If the API should remain backward-compatible, update this required list to not require scaling_group (and keep server-side validation consistent).
| "scaling_group", |
| """ | ||
| Get watcher information. | ||
|
|
||
| :return addr: address of agent watcher (eg: http://127.0.0.1:6009) |
Copilot
AI
Jan 22, 2026
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.
The docstring example uses port 6009, but the default watcher port in this function is 6099. Please align the example with the actual default to avoid confusion during ops/debugging.
| :return addr: address of agent watcher (eg: http://127.0.0.1:6009) | |
| :return addr: address of agent watcher (eg: http://127.0.0.1:6099) |
| @check_api_params( | ||
| t.Dict({ | ||
| t.Key("scaling_group", default=None): t.Null | t.String, | ||
| t.Key("scaling_group"): t.String, |
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.
Modifying the existing schema doesn’t look ideal.
Although there’s a desire to enforce stricter value constraints, it’s not something we can change in the current API.
Introducing a new API for this purpose would be a better option.
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.
Understood
I will look for better way to handle it, while retainig a exsiting api handlers.
Another small question here:
| cors.add(add_route("POST", "/check-presets", check_presets)) |
is being handled as "POST", although it doesn't effects current state,
best practice i think would be "GET" with parameter querier.
Current plan is adding new handler with "GET" with new function which we can use while transition.
- Add check_presets (GET) with required scaling_group - Keep check_presets_legacy (POST) for backward compatibility - Move get_watcher_info to vfolder.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fdee337 to
c229676
Compare
Co-authored-by: octodog <mu001@lablup.com>
| }, | ||
| "/resource/check-presets": { | ||
| "post": { | ||
| "get": { |
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.
Could you check why the open api schema generator changed this?
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.
c229676#diff-51adf4e1db91582bd045aea8a34e9565383e2c437c8cf7aa9eab64aebbdf9b3cR415-R416
- cors.add(add_route("POST", "/check-presets", check_presets))
+ cors.add(add_route("GET", "/check-presets", check_presets))
+ cors.add(add_route("POST", "/check-presets", check_presets_legacy))
I guess that modifcation of OpenAPI would occured from here.
With intention of soft migration I've added Get handler for legacy Post handler which doesn't make sense As it doesn't modify any state of program.
but i still need to investigate why "post" were deleted instead of coexistencing.
HyeockJinKim
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.
I wasn't suggesting creating a new API for the check preset right now.
If we did that, it would require corresponding changes to the web UI, and if we're going to create a new API, it seems better to design it from scratch and implement it.
|
that make sense. I'll just add some comments about discussions we've made and leave it for now. |
resolves #8218 (BA-4011)
Remove Legacy TODOs before migrating
resource.pywhich is now replaced with dict type enforcement.
agent_watchfunction has no relation withresource.pyand is only reffered fromvfoldermoved into vfolder with added description for future plan.Checklist: (if applicable)
ai.backend.testdocsdirectory📚 Documentation preview 📚: https://sorna--8219.org.readthedocs.build/en/8219/
📚 Documentation preview 📚: https://sorna-ko--8219.org.readthedocs.build/ko/8219/