-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Machine: use table for machine list and status outputs #6893
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
Conversation
338ab28 to
21e8e6e
Compare
|
Nice! Two questions:
|
I guess machine reads requires |
Sorry, I gave This also will different depending on the number of columns. If we follow the lead of |
|
Another example is the docker ps and docker images which show in a no border table format. |
|
Right, |
I agree with @karajan1001 about requiring
I find all current fields, shown in the description, pretty much useful (except for private fields). I can even have two machines with all same fields with the except |
|
Machine readable was the wrong term. It's about being able to grep and otherwise parse with unix-like tools. See #6046 and https://clig.dev/#output. A lot of other commands have outputs that were designed before we had these guidelines. Is there a reason not to follow this guideline here? |
|
@Mergifyio rebase |
❌ Base branch update has failedGit reported the following error: err-code: 3B142 |
fa49ffe to
4b9a894
Compare
|
The new table format looks fine to me. I think it probably looks a bit cleaner without the table borders (and makes it more grep-able), but I don't have a strong opinion here either way. |
Borrowed this idea from pandas api. Current dropna methods will drop a column or row if any data is missing. But it is also quite useful to drop those columns or rows only if all of its elements are missing. This is mostly used for pruning a table.
fix: treeverse#6892 Current output of machine list is quite urgly, it is originaly used to show configurations. In this PR, we use a new table format for it.
Because our machine name now is the key value of the machine config dict. And the machine config value will been overwritten by it when the config is loaded. We can remove the field `name` from the config.
Change the output format of `dvc machine status` command to tables for a better readability.
|
@dberenbaum |
|
Looks great, thanks @karajan1001! |
| from dvc.compare import TabularData | ||
| from dvc.config import ConfigError | ||
| from dvc.exceptions import DvcException | ||
| from dvc.types import Dict, List |
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 should come from typing module.
|
|
||
|
|
||
| CellT = Union[str, "RichText"] # RichText is mostly compatible with str | ||
| CellT = Union[str, "RichText", None] # RichText is mostly compatible with 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.
Please don't extend the types here. Table rendering does not support None for now.
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.
Then what should I set here ?
https://github.com/iterative/dvc/blob/eac030598cdbfaba4c029f8e1131614916a6c707/dvc/command/machine.py#L253
It looks like an empty string didn't work in this case.
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.
Use a fill value "-" or just empty 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.
Fill value is a bit too hard code I think, and empty string "" it was just because it gives empty result instead of a fill value made me using None in this case. And in
Only a None value would be filled with FILL_VALUE
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.
@skshetry How about adding a new type InputCellT which can accept None value for those input functions like append, extend or row_from_dict?
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.
@karajan1001, we'll need to fix that in #7167. Meanwhile, this may introduce unnecessary bugs, as rendering with rich table is not capable of supporting None, could you please roll back the type of CellT, and make adjustments, please?
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.
@karajan1001, we'll need to fix that in #7167. Meanwhile, this may introduce unnecessary bugs, as rendering with
richtable is not capable of supportingNone, could you please roll back the type ofCellT, and make adjustments, please?
No problem.
fix #6892
use table for the machine list outputs
Now the outputs looks like
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏