-
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
Changes from all commits
7f2aae1
f225558
096d780
07b0c0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| SHOW_MAX_WIDTH = 1024 | ||
|
|
||
|
|
||
| CellT = Union[str, "RichText"] # RichText is mostly compatible with str | ||
| CellT = Union[str, "RichText", None] # RichText is mostly compatible with str | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't extend the types here. Table rendering does not support
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then what should I set here ?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a fill value "-" or just empty string
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Only a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @skshetry How about adding a new type
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No problem. |
||
| Row = Sequence[CellT] | ||
| TableData = Sequence[Row] | ||
| Headers = Sequence[str] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,23 @@ | ||
| from dvc.command.machine import CmdMachineStatus | ||
| from dvc.main import main | ||
| from dvc.ui import ui | ||
| from tests.utils import console_width | ||
|
|
||
|
|
||
| def test_status( | ||
| tmp_dir, scm, dvc, machine_config, machine_instance, mocker, capsys | ||
| ): | ||
| status = machine_instance | ||
| assert main(["machine", "status", "foo"]) == 0 | ||
| def test_status(tmp_dir, scm, dvc, machine_config, machine_instance, capsys): | ||
|
|
||
| assert main(["machine", "add", "bar", "aws"]) == 0 | ||
| with console_width(ui.rich_console, 255): | ||
| assert main(["machine", "status"]) == 0 | ||
| cap = capsys.readouterr() | ||
| assert "machine 'foo':\n" in cap.out | ||
| assert "\tinstance_num_1:\n" in cap.out | ||
| for key in CmdMachineStatus.SHOWN_FIELD: | ||
| assert f"\t\t{key:20}: {status[key]}\n" in cap.out | ||
| assert ( | ||
| "name instance status cloud instance_ip " | ||
| "instance_type instance_hdd_size instance_gpu" | ||
| ) in cap.out | ||
| assert ( | ||
| "bar - offline - - " | ||
| "- - -" | ||
| ) in cap.out | ||
| assert ( | ||
| "foo num_1 running aws 123.123.123.123 " | ||
| "m 35 None" | ||
| ) in cap.out |
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
typingmodule.