diff --git a/dvc/project.py b/dvc/project.py index c71a0b2b7..5321f20f3 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -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) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 3aa7ae519..3cd9f8804 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -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