Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

feat: Add command to get available resources #165

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

romanceformoon
Copy link

lablup/backend.ai#249

This PR adds API to get available resources in groups.
Users can get available resources by API GET method.

@CLAassistant
Copy link

CLAassistant commented Jul 5, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jul 5, 2021

Codecov Report

Merging #165 (fd5e6dd) into main (4899ed3) will decrease coverage by 0.07%.
The diff coverage is 35.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #165      +/-   ##
==========================================
- Coverage   41.81%   41.74%   -0.08%     
==========================================
  Files          68       69       +1     
  Lines        6613     6684      +71     
==========================================
+ Hits         2765     2790      +25     
- Misses       3848     3894      +46     
Impacted Files Coverage Δ
src/ai/backend/client/cli/resource.py 28.88% <28.88%> (ø)
src/ai/backend/client/cli/pretty.py 43.57% <33.33%> (-0.96%) ⬇️
src/ai/backend/client/func/resource.py 51.89% <50.00%> (-0.35%) ⬇️
src/ai/backend/client/cli/manager.py 28.87% <66.66%> (+0.50%) ⬆️
src/ai/backend/client/cli/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4899ed3...fd5e6dd. Read the comment docs.

@romanceformoon romanceformoon changed the title release: Add command to get available resources feat: Add command to get available resources Jul 6, 2021
Comment on lines 227 to 228
print(' CPU:', ret['scaling_group_remaining']['cpu'])
print(' Memory:', ret['scaling_group_remaining']['mem'])
Copy link
Member

@achimnol achimnol Jul 10, 2021

Choose a reason for hiding this comment

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

There may be more resource slot types.
Please use session.Resource.get_resource_slots() to retrieve the exact list of the currently configured resource slots, and then iterate over it when displaying the remainings.
Note that you may need to have an extra mapping from the resource slot name to a human-readable name with a fallback to the raw slot name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants