odb: pin index pickle protocol version

This commit is contained in:
Peter Rowlands
2022-01-04 20:22:08 +02:00
committed by Ruslan Kuprieiev
parent 6bb4889022
commit 9e590edb70
+8 -2
View File
@@ -88,7 +88,7 @@ class ObjectDBIndex(ObjectDBIndexBase):
tmp_dir: "StrPath",
name: str,
): # pylint: disable=super-init-not-called
from diskcache import Index
from diskcache import Cache, Index
from dvc.fs.local import LocalFileSystem
from dvc.utils.fs import makedirs
@@ -96,7 +96,13 @@ class ObjectDBIndex(ObjectDBIndexBase):
self.index_dir = os.path.join(tmp_dir, self.INDEX_DIR, name)
makedirs(self.index_dir, exist_ok=True)
self.fs = LocalFileSystem()
self.index = Index(self.index_dir)
self.index = Index.fromcache(
Cache(
self.index_dir,
disk_pickle_protocol=4,
eviction_policy="none",
)
)
def __iter__(self):
return iter(self.index)