Skip to content

Commit

Permalink
exp show: output executor info for successful exps when available
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Jan 29, 2024
1 parent df5b582 commit 9c55949
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dvc/repo/experiments/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def _collect_baseline(
ref_it = (ref for ref in iter(refs) if ref.startswith(str(ref_info)))
else:
ref_it = repo.scm.iter_refs(base=str(ref_info))
executors = repo.experiments.celery_queue.collect_success_executors([baseline_rev])
for ref in ref_it:
try:
ref_info = ExpRefInfo.from_ref(ref)
Expand All @@ -272,7 +273,11 @@ def _collect_baseline(
exps = list(collect_branch(repo, exp_rev, baseline_rev, **kwargs))
if exps:
exps[0].name = ref_info.name
yield ExpRange(exps, name=ref_info.name)
yield ExpRange(
exps,
name=ref_info.name,
executor=executors.get(str(ref_info)),
)


def collect(
Expand Down
31 changes: 30 additions & 1 deletion dvc/repo/experiments/queue/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

from dvc.repo.experiments.executor.base import ExecutorResult
from dvc.repo.experiments.refs import ExpRefInfo
from dvc.repo.experiments.serialize import ExpRange
from dvc.repo.experiments.serialize import ExpExecutor, ExpRange
from dvc_task.app import FSApp
from dvc_task.proc.manager import ProcessManager
from dvc_task.worker import TemporaryWorker
Expand Down Expand Up @@ -632,3 +632,32 @@ def collect_failed_data(
)
)
return result

def collect_success_executors(
self,
baseline_revs: Optional[Collection[str]],
**kwargs,
) -> Dict[str, "ExpExecutor"]:
"""Map exp refs to any available successful executors."""
from dvc.repo.experiments.serialize import ExpExecutor, LocalExpExecutor

result: Dict[str, "ExpExecutor"] = {}
for entry, exec_result in self.iter_success():
if baseline_revs and entry.baseline_rev not in baseline_revs:
continue
if not (exec_result and exec_result.ref_info):
continue
proc_info = self.proc.get(entry.stash_rev)
if proc_info:
local_exec: Optional[LocalExpExecutor] = LocalExpExecutor(
log=proc_info.stdout,
pid=proc_info.pid,
returncode=proc_info.returncode,
task_id=entry.stash_rev,
)
else:
local_exec = None
result[str(exec_result.ref_info)] = ExpExecutor(
"success", name="dvc-task", local=local_exec
)
return result

0 comments on commit 9c55949

Please sign in to comment.