experiments: fix checkpoints sorting issues in dvc exp show (#4740)

* experiments: order experiment (branches) by timestamp

* checkpoints: sort checkpoint branches by tip commit values

* remove sort logic from dvc.scm
This commit is contained in:
Peter Rowlands (변기호)
2020-10-20 14:54:43 +09:00
committed by GitHub
parent 10ae13132d
commit feaa5cfcb2
2 changed files with 11 additions and 2 deletions
+5 -1
View File
@@ -155,7 +155,11 @@ def _sort_exp(experiments, sort_by, typ, reverse):
ret = OrderedDict()
def _sort(item):
_, exp = item
rev, exp = item
tip = exp.get("checkpoint_tip")
if tip and tip != rev:
# Sort checkpoint experiments by tip commit
return _sort((tip, experiments[tip]))
for fname, item in exp.get(typ, {}).items():
if isinstance(item, dict):
item = flatten(item)
+6 -1
View File
@@ -110,7 +110,12 @@ def show(
)
# collect reproduced experiments
for exp_branch in repo.experiments.scm.list_branches():
for head in sorted(
repo.experiments.scm.repo.heads,
key=lambda h: h.commit.committed_date,
reverse=True,
):
exp_branch = head.name
m = repo.experiments.BRANCH_RE.match(exp_branch)
if m:
rev = repo.scm.resolve_rev(m.group("baseline_rev"))