Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions dvc/command/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def _extend(row, names, items):
item = {fname: item}
for name in names:
if name in item:
row.append(str(_round(item[name])))
value = item[name]
text = str(_round(value)) if value is not None else "-"
row.append(text)
else:
row.append("-")

Expand Down Expand Up @@ -88,9 +90,9 @@ def _show_experiments(all_experiments, console, precision=None):
metric_names, param_names = _collect_names(all_experiments)

table = Table()
table.add_column("Experiment")
table.add_column("Experiment", no_wrap=True)
for name in metric_names:
table.add_column(name, justify="right")
table.add_column(name, justify="right", no_wrap=True)
for name in param_names:
table.add_column(name, justify="left")

Expand Down Expand Up @@ -125,15 +127,19 @@ def run(self):
all_commits=self.args.all_commits,
)

# Note: rich does not currently include a native way to force
# infinite width for use with a pager
console = Console(
file=io.StringIO(), force_terminal=True, width=9999
)
if self.args.no_pager:
console = Console()
else:
# Note: rich does not currently include a native way to force
# infinite width for use with a pager
console = Console(
file=io.StringIO(), force_terminal=True, width=9999
)

_show_experiments(all_experiments, console)

pager(console.file.getvalue())
if not self.args.no_pager:
pager(console.file.getvalue())
except DvcException:
logger.exception("failed to show experiments")
return 1
Expand Down Expand Up @@ -273,6 +279,12 @@ def add_parser(subparsers, parent_parser):
default=False,
help="Show metrics for all commits.",
)
experiments_show_parser.add_argument(
"--no-pager",
action="store_true",
default=False,
help="Do not pipe output into a pager.",
)
experiments_show_parser.set_defaults(func=CmdExperimentsShow)

EXPERIMENTS_CHECKOUT_HELP = "Checkout experiments."
Expand Down