-
Notifications
You must be signed in to change notification settings - Fork 13
Added --format and --plain options to the 'backend.ai ps' command #80
Conversation
Codecov Report
@@ Coverage Diff @@
## master #80 +/- ##
==========================================
+ Coverage 43.01% 43.67% +0.65%
==========================================
Files 50 50
Lines 5145 5569 +424
==========================================
+ Hits 2213 2432 +219
- Misses 2932 3137 +205
Continue to review full report at Codecov.
|
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.
A few minor fixes please!
@@ -28,7 +28,7 @@ other users by adding ``--access-key`` option here. | |||
|
|||
backend.ai admin sessions | |||
|
|||
Both commands offers options to set the status filter as follows. | |||
Both commands offer options to set the status filter as follows. |
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.
👍
docs/cli/sessions.rst
Outdated
``Max Used Memory (MiB)``, and ``CPU Using (%)``. | ||
|
||
* - ``-f``, ``--format`` | ||
- ``Session ID``, ``Owner``, and specified fields by user. |
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 think it's better to remove these two default-included fields for full customizability.
Such "templated" options are already there: --detail
, --id-only
.
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.
Just show an error sayng "at least one field is required for custom format" if there is no fields given at all.
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 changed that part. If user does not pass any argument, it shows error message saying that Error: --format option requires an argument
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.
Even though I print failure message "At least one field is required for custom format", it still prints the error message above. I think it is related to the click
package.
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, then it's okay to assume that there will be at least one item in the format argument.
.. note:: | ||
Fields for ``-f/--format`` option can be displayed by specifying comma-separated parameters. | ||
|
||
Available parameters for this option are: ``id``, ``status``, ``status_info``, ``created_at``, ``last_updated``, ``result``, ``image``, ``type``, ``task_id``, ``tag``, ``occupied_slots``, ``used_memory``, ``max_used_memory``, ``cpu_using``. |
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.
👍
@@ -32,7 +51,9 @@ | |||
@click.option('-a', '--all', is_flag=True, | |||
help='Display all sessions matching the condition using pagination.') | |||
@click.option('--detail', is_flag=True, help='Show more details using more columns.') | |||
def sessions(status, access_key, id_only, show_tid, dead, running, all, detail): | |||
@click.option('-f', '--format', default=None, help='Display only specified fields.') | |||
@click.option('--plain', is_flag=True, help='Display process status in plain format.') |
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.
"process status" looks somewhat ambiguous.
Let's say "Display the session list without decorative line drawings and the header."
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.
Also don't forget to update the same option in ps.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.
Got it!
Thank you for your feedback, @achimnol !!! |
lablup/backend.ai#87
@achimnol
Added --format/-f options for "backend.ai ps"/"backend.ai admin session" commands
Added --plain option to see process status info in plain tabular format
I will update the documentation file as soon as possible