plots: handle NoRemoteError for dirs (#5976)

This commit is contained in:
Ruslan Kuprieiev
2021-05-07 14:35:35 +03:00
committed by GitHub
parent 19f2fe52e6
commit 0ad1408da7
2 changed files with 20 additions and 3 deletions
+15 -3
View File
@@ -51,6 +51,7 @@ class Plots:
}}}
Data parsing is postponed, since it's affected by props.
"""
from dvc.config import NoRemoteError
from dvc.fs.repo import RepoFileSystem
from dvc.utils.collections import ensure_list
@@ -71,10 +72,21 @@ class Plots:
if fs.isdir(path_info):
plot_files = []
for pi in fs.walk_files(path_info):
plot_files.append(
(pi, relpath(pi, self.repo.root_dir))
try:
for pi in fs.walk_files(path_info):
plot_files.append(
(pi, relpath(pi, self.repo.root_dir))
)
except NoRemoteError:
logger.debug(
(
"Could not find cache for directory '%s' on "
"'%s'. Files inside will not be plotted."
),
path_info,
rev,
)
continue
else:
plot_files = [
(path_info, relpath(path_info, self.repo.root_dir))
+5
View File
@@ -828,6 +828,11 @@ def test_show_dir_plots(tmp_dir, dvc, run_copy_metrics):
result = dvc.plots.show(targets=[p1])
assert set(result.keys()) == {p1}
remove(dvc.odb.local.cache_dir)
remove(subdir)
with pytest.raises(NoMetricsParsedError):
dvc.plots.show()
def test_ignore_binary_file(tmp_dir, dvc, run_copy_metrics):
with open("file", "wb") as fobj: