mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-08 23:09:48 +01:00
state: store cache state on per-repo basis
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+4
-1
@@ -10,7 +10,7 @@ from dvc.logger import Logger
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.stage import Stage
|
||||
from dvc.config import Config
|
||||
from dvc.state import LinkState
|
||||
from dvc.state import LinkState, State
|
||||
from dvc.lock import Lock
|
||||
from dvc.scm import SCM, Base
|
||||
from dvc.cache import Cache
|
||||
@@ -50,6 +50,9 @@ class Project(object):
|
||||
self.config = Config(self.dvc_dir)
|
||||
self.scm = SCM(self.root_dir)
|
||||
self.lock = Lock(self.dvc_dir)
|
||||
# NOTE: storing state and link_state in the repository itself to avoid
|
||||
# any possible state corruption in 'shared cache dir' scenario.
|
||||
self.state = State(self.dvc_dir)
|
||||
self.link_state = LinkState(self.root_dir, self.dvc_dir)
|
||||
self.logger = Logger(self.config._config[Config.SECTION_CORE].get(Config.SECTION_CORE_LOGLEVEL, None))
|
||||
self.cache = Cache(self)
|
||||
|
||||
+1
-2
@@ -31,6 +31,7 @@ class RemoteLOCAL(RemoteBase):
|
||||
|
||||
def __init__(self, project, config):
|
||||
self.project = project
|
||||
self.state = self.project.state
|
||||
self.link_state = project.link_state
|
||||
storagepath = config.get(Config.SECTION_AWS_STORAGEPATH, None)
|
||||
self.cache_dir = config.get(Config.SECTION_REMOTE_URL, storagepath)
|
||||
@@ -46,8 +47,6 @@ class RemoteLOCAL(RemoteBase):
|
||||
if self.cache_dir != None and not os.path.exists(self.cache_dir):
|
||||
os.mkdir(self.cache_dir)
|
||||
|
||||
self.state = State(self.cache_dir)
|
||||
|
||||
@property
|
||||
def prefix(self):
|
||||
return self.cache_dir
|
||||
|
||||
Reference in New Issue
Block a user