From e6bcdd3979fbe1b9114087ace90390a42b8b8cb4 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Tue, 3 Jul 2018 00:03:55 +0300 Subject: [PATCH] link: exclude unsupported link types after trying once Signed-off-by: Ruslan Kuprieiev --- dvc/remote/local.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 1922a4801..987369084 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -91,20 +91,19 @@ class RemoteLOCAL(RemoteBase): if not os.path.exists(dname): os.makedirs(dname) - if self.cache_types != None: - types = self.cache_types - else: - types = self.CACHE_TYPES - - for typ in types: + i = 0 + N = len(self.cache_types) + while i < N: try: - self.CACHE_TYPE_MAP[typ](cache, path) + self.CACHE_TYPE_MAP[self.cache_types[i]](cache, path) return except Exception as exc: - msg = 'Cache type \'{}\' is not supported'.format(typ) + msg = 'Cache type \'{}\' is not supported'.format(self.cache_types[i]) Logger.debug(msg) - if typ == types[-1]: - raise DvcException(msg, cause=exc) + del self.cache_types[i] + i += 1 + + raise DvcException('No possible cache types left to try out.') def load_dir_cache(self, md5): path = self.get(md5)