Skip to content

Commit

Permalink
exp: show: Include fs_path and use_cache in --json.
Browse files Browse the repository at this point in the history
Closes #7575
  • Loading branch information
daavoo committed May 3, 2022
1 parent 68a3cd9 commit 19fc2f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dvc/repo/experiments/show.py
Expand Up @@ -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))
Expand All @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions tests/func/experiments/test_show.py
Expand Up @@ -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,
Expand All @@ -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()
Expand All @@ -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,
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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,
}
}

Expand Down

0 comments on commit 19fc2f7

Please sign in to comment.