mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-27 07:18:28 +01:00
dvc: introduce local build cache (#3603)
This patch introduces `.dvc/cache/stages` that is used to store previous runs and their results, which could then be reused later when we stumble upon the same command with the same deps and outs. Format of build cache entries is single-line json, which is readable by humans and might also be used for lock files discussed in #1871. Related to #1871 Local part of #1234
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
|
||||
import configobj
|
||||
@@ -341,6 +342,7 @@ def test_gc_not_collect_pipeline_tracked_files(tmp_dir, dvc, run_copy):
|
||||
tmp_dir.gen("bar", "bar")
|
||||
|
||||
run_copy("foo", "foo2", name="copy")
|
||||
shutil.rmtree(dvc.stage_cache.cache_dir)
|
||||
assert _count_files(dvc.cache.local.cache_dir) == 1
|
||||
dvc.gc(workspace=True, force=True)
|
||||
assert _count_files(dvc.cache.local.cache_dir) == 1
|
||||
|
||||
@@ -1295,7 +1295,9 @@ class TestReproNoCommit(TestRepro):
|
||||
["repro", self._get_stage_target(self.stage), "--no-commit"]
|
||||
)
|
||||
self.assertEqual(ret, 0)
|
||||
self.assertFalse(os.path.exists(self.dvc.cache.local.cache_dir))
|
||||
self.assertEqual(
|
||||
os.listdir(self.dvc.cache.local.cache_dir), ["stages"]
|
||||
)
|
||||
|
||||
|
||||
class TestReproAlreadyCached(TestRepro):
|
||||
|
||||
Reference in New Issue
Block a user