fetch: cache collected

This avoids recollecting the cache files over and over again.

For example, `dvc fetch` noop in `dvc-bench` went from ~30sec down to ~10sec
for me.

Next step is to also cache remote index, so we don't have to waste those
~10sec checking files in the remote.

Related https://github.com/iterative/dvc-data/pull/376
This commit is contained in:
Ruslan Kuprieiev
2023-06-12 04:31:37 +03:00
parent 0597311439
commit 2ed677057d
4 changed files with 55 additions and 29 deletions
+3 -3
View File
@@ -197,8 +197,8 @@ def test_verify_hashes(tmp_dir, scm, dvc, mocker, tmp_path_factory, local_remote
hash_spy = mocker.spy(dvc_data.hashfile.hash, "file_md5")
dvc.pull()
# NOTE: 1 is for index.data_tree building
assert hash_spy.call_count == 2
# NOTE: 2 are for index.data_tree building
assert hash_spy.call_count == 3
# Removing cache will invalidate existing state entries
dvc.cache.local.clear()
@@ -206,7 +206,7 @@ def test_verify_hashes(tmp_dir, scm, dvc, mocker, tmp_path_factory, local_remote
dvc.config["remote"]["upstream"]["verify"] = True
dvc.pull()
assert hash_spy.call_count == 8
assert hash_spy.call_count == 10
@flaky(max_runs=3, min_passes=1)