mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +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:
@@ -6,6 +6,7 @@ import pytest
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.utils import (
|
||||
file_md5,
|
||||
dict_sha256,
|
||||
resolve_output,
|
||||
fix_env,
|
||||
relpath,
|
||||
@@ -155,3 +156,28 @@ def test_hint_on_lockfile():
|
||||
with pytest.raises(Exception) as exc:
|
||||
assert parse_target("pipelines.lock:name")
|
||||
assert "pipelines.yaml:name" in str(exc.value)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"d,sha",
|
||||
[
|
||||
(
|
||||
{
|
||||
"cmd": "echo content > out",
|
||||
"deps": {"dep": "2254342becceafbd04538e0a38696791"},
|
||||
"outs": {"out": "f75b8179e4bbe7e2b4a074dcef62de95"},
|
||||
},
|
||||
"f472eda60f09660a4750e8b3208cf90b3a3b24e5f42e0371d829710e9464d74a",
|
||||
),
|
||||
(
|
||||
{
|
||||
"cmd": "echo content > out",
|
||||
"deps": {"dep": "2254342becceafbd04538e0a38696791"},
|
||||
"outs": ["out"],
|
||||
},
|
||||
"a239b67073bd58affcdb81fff3305d1726c6e7f9c86f3d4fca0e92e8147dc7b0",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_dict_sha256(d, sha):
|
||||
assert dict_sha256(d) == sha
|
||||
|
||||
Reference in New Issue
Block a user