-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add disks management commands #1716
Conversation
606278f
to
3948994
Compare
Codecov Report
@@ Coverage Diff @@
## master #1716 +/- ##
==========================================
- Coverage 87.18% 86.11% -1.07%
==========================================
Files 59 62 +3
Lines 8849 8969 +120
Branches 1440 1445 +5
==========================================
+ Hits 7715 7724 +9
- Misses 890 985 +95
- Partials 244 260 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
c476e5d
to
07fc74e
Compare
53edba9
to
9e9036c
Compare
neuromation/cli/formatters/disks.py
Outdated
if disk.storage >= 1024 ** 3: | ||
storage_str = f"{disk.storage / (1024 ** 3):.2f}G" | ||
elif disk.storage >= 1024 ** 2: | ||
storage_str = f"{disk.storage / (1024 ** 2):.2f}M" | ||
elif disk.storage >= 1024: | ||
storage_str = f"{disk.storage / 1024:.2f}K" | ||
else: | ||
storage_str = str(disk.storage) |
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.
Can it use cli.utils.format_size()
?
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.
Yes, sure, thanks for pointing out.
d13b506
to
e87979f
Compare
docs/disks_reference.rst
Outdated
|
||
:return: Newly created disk info (:class:`Disk`) | ||
|
||
.. comethod:: get(disk_id: str) -> None |
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.
What does it return?
neuromation/api/disks.py
Outdated
status=next( | ||
status for status in Disk.Status if status.value == payload["status"] | ||
), |
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.
Why not Disk.Status(payload["status"])
?
neuromation/api/disks.py
Outdated
storage: int # In bytes | ||
owner: str | ||
status: "Disk.Status" | ||
_cluster: str |
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.
Why is it underscored?
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.
At first I thought that this is some kind of internal data (as it isn't returned from server), but now I see no reason to underscore this field.
neuromation/api/disks.py
Outdated
storage: int # In bytes | ||
owner: str | ||
status: "Disk.Status" | ||
cluster: str |
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.
In all other classes (_ConfigData
, JobDescription
, RemoteImage
, _QuotaInfo
) we use attributes named cluster_name
. Name cluster
is never used. It is rather by accident, but it would be better to continue the tradition.
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.
👍
Part of #1715