Fix dvclive running subdir (#6740)

* Fix dvclive running subdir

* Apply suggestions from code review

Co-authored-by: Saugat Pachhai <[email protected]>

* Applied suggestions

* Update tests/func/test_live.py

Co-authored-by: Saugat Pachhai <[email protected]>
This commit is contained in:
David de la Iglesia Castro
2021-10-05 13:16:33 +05:45
committed by GitHub
co-authored by Saugat Pachhai
parent 0eda4bd91c
commit 16f404b16a
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -273,7 +273,7 @@ class Stage(params.StageParams):
from dvc.output import Output
from dvc.schema import LIVE_PROPS
env[DVCLIVE_PATH] = str(out.path_info)
env[DVCLIVE_PATH] = relpath(out.path_info, self.wdir)
if isinstance(out.live, dict):
config = project(out.live, LIVE_PROPS)
+19
View File
@@ -255,3 +255,22 @@ def test_dvc_generates_html_during_run(tmp_dir, dvc, mocker, live_stage):
live_stage(summary=True, live="logs", code=script)
assert show_spy.call_count == 2
def test_dvclive_stage_with_different_wdir(tmp_dir, scm, dvc):
(tmp_dir / "subdir").gen("train.py", LIVE_SCRIPT)
(tmp_dir / "subdir" / "params.yaml").dump({"foo": 1})
dvc.stage.add(
cmd="python train.py",
params=["foo"],
deps=["train.py"],
name="live_stage",
live="dvclive",
live_no_html=True,
wdir="subdir",
)
dvc.reproduce()
assert (tmp_dir / "subdir" / "dvclive").is_dir()
assert (tmp_dir / "subdir" / "dvclive.json").is_file()