Skip to content

Commit

Permalink
plots: fix caching of legacy format (#9849)
Browse files Browse the repository at this point in the history
* plots: fix caching of legacy format

* deps: bump dvc-data minversion to 2.15.0
  • Loading branch information
skshetry authored Aug 17, 2023
1 parent f0c1ff0 commit 8098fd1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 2 additions & 5 deletions dvc/fs/dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,12 @@ def _open(
try:
return self.repo.fs.open(fs_path, mode=mode)
except FileNotFoundError:
repo, dvc_fs, subkey = self._get_subrepo_info(key)
_, dvc_fs, subkey = self._get_subrepo_info(key)
if not dvc_fs:
raise

dvc_path = _get_dvc_path(dvc_fs, subkey)
kw = {}
if kwargs.get("cache_remote_stream", False):
kw["cache_odb"] = repo.cache.local
return dvc_fs.open(dvc_path, mode=mode, **kw)
return dvc_fs.open(dvc_path, mode=mode, cache=kwargs.get("cache", False))

def isdvc(self, path, **kwargs) -> bool:
"""Is this entry dvc-tracked?"""
Expand Down
8 changes: 3 additions & 5 deletions dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def show(
short_rev = "workspace"
if rev := getattr(self.repo.fs, "rev", None):
short_rev = rev[:7]
_resolve_data_sources(data, short_rev, cache_remote_stream=True)
_resolve_data_sources(data, short_rev, cache=True)
result.update(data)

errored = errored_revisions(result)
Expand Down Expand Up @@ -281,9 +281,7 @@ def _is_plot(out: "Output") -> bool:
return bool(out.plot)


def _resolve_data_sources(
plots_data: Dict, rev: str, cache_remote_stream: bool = False
):
def _resolve_data_sources(plots_data: Dict, rev: str, cache: bool = False):
from dvc.progress import Tqdm

values = list(plots_data.values())
Expand All @@ -298,7 +296,7 @@ def _resolve_data_sources(
def resolve(value):
data_source = value.pop("data_source")
assert callable(data_source)
value.update(data_source(cache_remote_stream=cache_remote_stream))
value.update(data_source(cache=cache))

if not to_resolve:
return
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
"configobj>=5.0.6",
"distro>=1.3",
"dpath<3,>=2.1.0",
"dvc-data>=2.14.0,<2.15.0",
"dvc-data>=2.15.0,<2.16.0",
"dvc-http>=2.29.0",
"dvc-render>=0.3.1,<1",
"dvc-studio-client>=0.9.2,<1",
Expand Down

0 comments on commit 8098fd1

Please sign in to comment.