Skip to content

Commit 8ec70e4

Browse files
author
Dave Berenbaum
authored
log_artifact: update warning inside exp (#669)
* log_artifact: update warning inside exp * fix test
1 parent 6b0f5cd commit 8ec70e4

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/dvclive/live.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def cache(self, path):
466466
return # skip caching
467467
logger.warning(
468468
f"To track '{path}' automatically during `dvc exp run`:"
469-
f"\n1. Run `dvc exp remove {existing_stage.addressing}` "
469+
f"\n1. Run `dvc remove {existing_stage.addressing}` "
470470
"to stop tracking it outside the pipeline."
471471
"\n2. Add it as an output of the pipeline stage."
472472
)

tests/test_log_artifact.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_log_artifact_inside_exp(tmp_dir, mocker, dvc_repo, tracked):
250250
elif tracked == "data_source":
251251
msg = (
252252
"To track 'data' automatically during `dvc exp run`:"
253-
"\n1. Run `dvc exp remove data.dvc` "
253+
"\n1. Run `dvc remove data.dvc` "
254254
"to stop tracking it outside the pipeline."
255255
"\n2. Add it as an output of the pipeline stage."
256256
)
@@ -263,3 +263,24 @@ def test_log_artifact_inside_exp(tmp_dir, mocker, dvc_repo, tracked):
263263
)
264264
logger.warning.assert_called_with(msg)
265265
spy.assert_called_once()
266+
267+
268+
def test_log_artifact_inside_exp_subdir(tmp_dir, mocker, dvc_repo):
269+
logger = mocker.patch("dvclive.live.logger")
270+
subdir = tmp_dir / "subdir"
271+
subdir.mkdir()
272+
data = subdir / "data"
273+
data.touch()
274+
dvc_repo.add(subdir)
275+
live = Live()
276+
spy = mocker.spy(live._dvc_repo, "add")
277+
live._inside_dvc_exp = True
278+
live.log_artifact("subdir/data")
279+
msg = (
280+
"To track 'subdir/data' automatically during `dvc exp run`:"
281+
"\n1. Run `dvc remove subdir.dvc` "
282+
"to stop tracking it outside the pipeline."
283+
"\n2. Add it as an output of the pipeline stage."
284+
)
285+
logger.warning.assert_called_with(msg)
286+
spy.assert_called_once()

0 commit comments

Comments
 (0)