Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup dvcyaml #615

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dvclive/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def _init_cleanup(self):
if f and os.path.exists(f):
os.remove(f)

if self.dvc_file and os.path.exists(self.dvc_file):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we had a discussion the first time we added the make_dvcyaml about not wanting to remove it on cleanup #366 (comment)

Do you think the concerns no longer apply (the config for sklearn is now auto-generated) and we can consider the dvclive/dvc.yaml not modifiable?

Copy link
Contributor

@daavoo daavoo Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, it looks like we are already overwriting in the code, so we never preserved the existing dvcyaml 😅

os.remove(self.dvc_file)

def _init_dvc(self):
from dvc.scm import NoSCM

Expand Down
2 changes: 2 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ def test_cleanup(tmp_dir, html):

assert (tmp_dir / dvclive.plots_dir / Metric.subfolder / "m1.tsv").is_file()
assert (tmp_dir / dvclive.metrics_file).is_file()
assert (tmp_dir / dvclive.dvc_file).is_file()
assert html_path.is_file() == html

dvclive = Live("logs")

assert (tmp_dir / "logs" / "some_user_file.txt").is_file()
assert not (tmp_dir / dvclive.plots_dir / Metric.subfolder).exists()
assert not (tmp_dir / dvclive.metrics_file).is_file()
assert not (tmp_dir / dvclive.dvc_file).is_file()
assert not (html_path).is_file()


Expand Down