This repository was archived by the owner on Aug 2, 2023. It is now read-only.
feat: Add API to get available resources#442
Open
romanceformoon wants to merge 9 commits intomainfrom
Open
Conversation
Codecov Report
@@ Coverage Diff @@
## main #442 +/- ##
==========================================
- Coverage 48.28% 48.16% -0.13%
==========================================
Files 52 52
Lines 8708 8763 +55
==========================================
+ Hits 4205 4221 +16
- Misses 4503 4542 +39
Continue to review full report at Codecov.
|
achimnol
reviewed
Jul 8, 2021
Member
achimnol
left a comment
There was a problem hiding this comment.
- Let's refactor the common reusable parts from
get_available_resources()and the above existingcheck_presets()handler as a shared function in theai.backend.models.resource_presetmodule, just likequery_allowed_sgroups(). - Though it seems that group resource checks are not implemented yet, please apply the group resource visibility option when you do.
| add_route = app.router.add_route | ||
| cors.add(add_route('GET', '/presets', list_presets)) | ||
| cors.add(add_route('POST', '/check-presets', check_presets)) | ||
| cors.add(add_route('GET', '/get-resources', get_available_resources)) |
Member
There was a problem hiding this comment.
Let's rename the URL to /available-resources since the HTTP method name "GET" already indicates its a query API.
achimnol
suggested changes
Jul 15, 2021
Member
achimnol
left a comment
There was a problem hiding this comment.
Please add type annotations as much as possible when you write new functions.
| return await simple_db_mutate(cls, info.context, delete_query) | ||
|
|
||
|
|
||
| async def get_row(conn, request, params, domain_name): |
Member
There was a problem hiding this comment.
Please clarify the name of this function. What is the row? Where is it from?
…rce prefix * WIP: rewriting resource check routines -- but we need to discuss the policy about visibility of scaling group capacity and the sum of other user's occupation to non-admin users, because these new APIs directly expose the exact amount of resources unlike the check-preset API. * fix: Apply consistent API logging headers (e.g., LIST_RESETS -> RESORUCE.LIST_PRESETS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lablup/backend.ai#249
This PR adds API to get available resources in groups.
Users can get available resources by API GET method.