mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-11 07:18:28 +01:00
plots: handle NoRemoteError for dirs (#5976)
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user