Skip to content

Commit 0658cc8

Browse files
daavooDave Berenbaumpre-commit-ci[bot]
authored
dvc: Drop checkpoint. (#667)
* dvc: Drop checkpoint. Leftover when upgradint to DVC 3.0 * Drop checkpoint test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Dave Berenbaum <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8113e2e commit 0658cc8

File tree

3 files changed

+0
-55
lines changed

3 files changed

+0
-55
lines changed

src/dvclive/dvc.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pathlib import Path
55
from typing import TYPE_CHECKING, Any, List, Optional
66

7-
from dvclive import env
87
from dvclive.plots import Image, Metric
98
from dvclive.serialize import dump_yaml
109
from dvclive.utils import StrPath
@@ -14,9 +13,6 @@
1413
from dvc.stage import Stage
1514

1615

17-
_CHECKPOINT_SLEEP = 0.1
18-
19-
2016
def _dvc_dir(dirname: StrPath) -> str:
2117
return os.path.join(dirname, ".dvc")
2218

@@ -60,21 +56,6 @@ def _write_file(file: str, contents=""):
6056
os.fsync(fobj.fileno())
6157

6258

63-
def make_checkpoint():
64-
from time import sleep
65-
66-
root_dir = _find_dvc_root()
67-
if not root_dir:
68-
return
69-
70-
signal_file = os.path.join(root_dir, ".dvc", "tmp", env.DVC_CHECKPOINT)
71-
72-
_write_file(signal_file)
73-
74-
while os.path.exists(signal_file):
75-
sleep(_CHECKPOINT_SLEEP)
76-
77-
7859
def get_dvc_repo() -> Optional["Repo"]:
7960
from dvc.exceptions import NotDvcRepoError
8061
from dvc.repo import Repo

src/dvclive/live.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
find_overlapping_stage,
1616
get_dvc_repo,
1717
get_random_exp_name,
18-
make_checkpoint,
1918
make_dvcyaml,
2019
mark_dvclive_only_ended,
2120
mark_dvclive_only_started,
@@ -291,7 +290,6 @@ def next_step(self):
291290
self.make_dvcyaml()
292291

293292
self.make_report()
294-
self.make_checkpoint()
295293
self.step += 1
296294

297295
def log_metric(
@@ -565,10 +563,6 @@ def end(self):
565563
else:
566564
self.make_report()
567565

568-
def make_checkpoint(self):
569-
if env2bool(env.DVC_CHECKPOINT):
570-
make_checkpoint()
571-
572566
def read_step(self):
573567
if Path(self.metrics_file).exists():
574568
latest = self.read_latest()

tests/test_main.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -411,36 +411,6 @@ def test_context_manager_skips_end_calls(tmp_dir):
411411
assert (tmp_dir / live.metrics_file).exists()
412412

413413

414-
@pytest.mark.parametrize("dvc_root", [True, False])
415-
@pytest.mark.parametrize("set_env", [True, False])
416-
def test_create_checkpoint_file(tmp_dir, monkeypatch, dvc_root, set_env, mocker):
417-
if dvc_root:
418-
(tmp_dir / ".dvc" / "tmp").mkdir(parents=True)
419-
if set_env:
420-
monkeypatch.setenv(env.DVC_CHECKPOINT, "1")
421-
422-
dvclive = Live()
423-
424-
native_exists = os.path.exists
425-
426-
def checkpoint_never_exists(path):
427-
# we need that to avoid waiting for dvc process to remove file
428-
if path.endswith(env.DVC_CHECKPOINT):
429-
return False
430-
431-
return native_exists(path)
432-
433-
with mocker.patch(
434-
"dvclive.dvc.os.path.exists", side_effect=checkpoint_never_exists
435-
):
436-
dvclive.make_checkpoint()
437-
438-
if dvc_root and set_env:
439-
assert native_exists(os.path.join(".dvc", "tmp", env.DVC_CHECKPOINT))
440-
else:
441-
assert not native_exists(os.path.join(".dvc", "tmp", env.DVC_CHECKPOINT))
442-
443-
444414
@pytest.mark.vscode()
445415
@pytest.mark.parametrize("dvc_root", [True, False])
446416
def test_vscode_dvclive_only_signal_file(tmp_dir, dvc_root, mocker):

0 commit comments

Comments
 (0)