Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions dvc/commands/experiments/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def run(self):
num=self.args.num,
sha_only=self.args.sha,
param_deps=self.args.param_deps,
fetch_running=self.args.fetch_running,
)
except DvcException:
logger.exception("failed to show experiments")
Expand Down Expand Up @@ -645,4 +646,10 @@ def add_parser(experiments_subparsers, parent_parser):
default=False,
help="Open the Parallel Coordinates Plot directly in the browser.",
)
experiments_show_parser.add_argument(
"--no-fetch",
dest="fetch_running",
action="store_false",
help=argparse.SUPPRESS,
)
experiments_show_parser.set_defaults(func=CmdExperimentsShow)
4 changes: 2 additions & 2 deletions dvc/repo/experiments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def get_exact_name(self, rev: str):
return self.stash_revs[rev].name
return None

def get_running_exps(self) -> Dict[str, int]:
def get_running_exps(self, fetch_refs: bool = True) -> Dict[str, int]:
"""Return info for running experiments."""
from dvc.scm import InvalidRemoteSCMRepo
from dvc.utils.serialize import load_json
Expand Down Expand Up @@ -774,7 +774,7 @@ def get_running_exps(self) -> Dict[str, int]:
result[rev] = info.asdict()
else:
result[rev] = info.asdict()
if info.git_url:
if info.git_url and fetch_refs:

def on_diverged(_ref: str, _checkpoint: bool):
return False
Expand Down
10 changes: 6 additions & 4 deletions dvc/repo/experiments/show.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import logging
from collections import OrderedDict, defaultdict
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Union
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union

from dvc.repo import Repo, locked # pylint: disable=unused-import
from dvc.repo.experiments.base import ExpRefInfo
from dvc.repo.metrics.show import _gather_metrics
from dvc.repo.params.show import _gather_params
from dvc.scm import iter_revs
from dvc.utils import error_handler, onerror_collect

if TYPE_CHECKING:
from dvc.repo import Repo

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -124,7 +126,6 @@ def _collect_experiment_branch(
return res


@locked
def show(
repo: "Repo",
all_branches=False,
Expand All @@ -135,6 +136,7 @@ def show(
num=1,
param_deps=False,
onerror: Optional[Callable] = None,
fetch_running: bool = True,
):

if onerror is None:
Expand All @@ -152,7 +154,7 @@ def show(
iter_revs(repo.scm, revs, num, all_branches, all_tags, all_commits)
)

running = repo.experiments.get_running_exps()
running = repo.experiments.get_running_exps(fetch_refs=fetch_running)

for rev in found_revs:
res[rev]["baseline"] = _collect_experiment_commit(
Expand Down
1 change: 1 addition & 0 deletions tests/unit/command/test_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def test_experiments_show(dvc, scm, mocker):
revs="foo",
sha_only=True,
param_deps=True,
fetch_running=True,
)


Expand Down