From 19fc2f738b53687dfef84295706f26057f42f136 Mon Sep 17 00:00:00 2001 From: David de la Iglesia Castro Date: Tue, 3 May 2022 20:44:12 +0200 Subject: [PATCH] exp: show: Include `fs_path` and `use_cache` in `--json`. Closes #7575 --- dvc/repo/experiments/show.py | 3 +++ tests/func/experiments/test_show.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/dvc/repo/experiments/show.py b/dvc/repo/experiments/show.py index 3c28ac7ca8..0f53304bed 100644 --- a/dvc/repo/experiments/show.py +++ b/dvc/repo/experiments/show.py @@ -49,6 +49,7 @@ def _collect_experiment_commit( "hash": dep.hash_info.value, "size": dep.meta.size, "nfiles": dep.meta.nfiles, + "fs_path": dep.fs_path, } for dep in repo.index.deps if not isinstance(dep, (ParamsDependency, RepoDependency)) @@ -59,6 +60,8 @@ def _collect_experiment_commit( "hash": out.hash_info.value, "size": out.meta.size, "nfiles": out.meta.nfiles, + "fs_path": out.fs_path, + "use_cache": out.use_cache, } for out in repo.index.outs if not (out.is_metric or out.is_plot) diff --git a/tests/func/experiments/test_show.py b/tests/func/experiments/test_show.py index efa7490e1e..c6fb7c2086 100644 --- a/tests/func/experiments/test_show.py +++ b/tests/func/experiments/test_show.py @@ -34,12 +34,14 @@ def make_executor_info(**kwargs): return ExecutorInfo(**kwargs) +@pytest.mark.vscode def test_show_simple(tmp_dir, scm, dvc, exp_stage): assert dvc.experiments.show()["workspace"] == { "baseline": { "data": { "deps": { "copy.py": { + "fs_path": ANY, "hash": ANY, "size": ANY, "nfiles": None, @@ -57,6 +59,7 @@ def test_show_simple(tmp_dir, scm, dvc, exp_stage): } +@pytest.mark.vscode @pytest.mark.parametrize("workspace", [True, False]) def test_show_experiment(tmp_dir, scm, dvc, exp_stage, workspace): baseline_rev = scm.get_rev() @@ -73,6 +76,7 @@ def test_show_experiment(tmp_dir, scm, dvc, exp_stage, workspace): "data": { "deps": { "copy.py": { + "fs_path": ANY, "hash": ANY, "size": ANY, "nfiles": None, @@ -101,6 +105,7 @@ def test_show_experiment(tmp_dir, scm, dvc, exp_stage, workspace): assert exp["data"]["params"]["params.yaml"] == expected_params +@pytest.mark.vscode def test_show_queued(tmp_dir, scm, dvc, exp_stage): baseline_rev = scm.get_rev() @@ -132,6 +137,7 @@ def test_show_queued(tmp_dir, scm, dvc, exp_stage): assert exp["params"]["params.yaml"] == {"data": {"foo": 3}} +@pytest.mark.vscode @pytest.mark.parametrize("workspace", [True, False]) def test_show_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, capsys, workspace @@ -169,6 +175,7 @@ def test_show_checkpoint( assert f"{fs} {name}" in cap.out +@pytest.mark.vscode @pytest.mark.parametrize("workspace", [True, False]) def test_show_checkpoint_branch( tmp_dir, scm, dvc, checkpoint_stage, capsys, workspace @@ -281,6 +288,7 @@ def test_show_filter( assert "Experiment" not in cap.out +@pytest.mark.vscode def test_show_multiple_commits(tmp_dir, scm, dvc, exp_stage): init_rev = scm.get_rev() tmp_dir.scm_gen("file", "file", "commit") @@ -318,6 +326,7 @@ def test_show_sort(tmp_dir, scm, dvc, exp_stage, caplog): ) +@pytest.mark.vscode def test_show_running_workspace(tmp_dir, scm, dvc, exp_stage, capsys): pid_dir = os.path.join(dvc.tmp_dir, EXEC_TMP_DIR, EXEC_PID_DIR) info = make_executor_info(location=BaseExecutor.DEFAULT_LOCATION) @@ -334,6 +343,7 @@ def test_show_running_workspace(tmp_dir, scm, dvc, exp_stage, capsys): "data": { "deps": { "copy.py": { + "fs_path": ANY, "hash": ANY, "size": ANY, "nfiles": None, @@ -626,6 +636,7 @@ def test_show_parallel_coordinates(tmp_dir, dvc, scm, mocker, capsys): assert '"label": "Experiment"' not in html_text +@pytest.mark.vscode def test_show_outs(tmp_dir, dvc, scm): tmp_dir.gen("copy.py", COPY_SCRIPT) params_file = tmp_dir / "params.yaml" @@ -649,9 +660,11 @@ def test_show_outs(tmp_dir, dvc, scm): outs = dvc.experiments.show()["workspace"]["baseline"]["data"]["outs"] assert outs == { "out": { + "fs_path": ANY, "hash": ANY, "size": ANY, "nfiles": None, + "use_cache": True, } }