repo: support basic workflow on s3fs/adlfs/etc

This commit is contained in:
Ruslan Kuprieiev
2022-08-03 21:10:28 +03:00
parent fcc7240617
commit 52bdd90840
2 changed files with 9 additions and 10 deletions
+9 -4
View File
@@ -1,8 +1,8 @@
from dvc.fs import Schemes
from dvc.fs import GitFileSystem, Schemes
from dvc_data.db import get_odb
def _get_odb(repo, settings):
def _get_odb(repo, settings, fs=None):
from dvc.fs import get_cloud_fs
if not settings:
@@ -10,7 +10,8 @@ def _get_odb(repo, settings):
cls, config, fs_path = get_cloud_fs(repo, **settings)
config["tmp_dir"] = repo.tmp_dir
return get_odb(cls(**config), fs_path, state=repo.state, **config)
fs = fs or cls(**config)
return get_odb(fs, fs_path, state=repo.state, **config)
class ODBManager:
@@ -42,7 +43,11 @@ class ODBManager:
if opt in config:
settings[str(opt)] = config.get(opt)
odb = _get_odb(repo, settings)
kwargs = {}
if not isinstance(repo.fs, GitFileSystem):
kwargs["fs"] = repo.fs
odb = _get_odb(repo, settings, **kwargs)
self._odb["repo"] = odb
self._odb[Schemes.LOCAL] = odb
-6
View File
@@ -341,9 +341,6 @@ class Output:
self.remote = remote
def _parse_path(self, fs, fs_path):
if fs.protocol != "local":
return fs_path
parsed = urlparse(self.def_path)
if parsed.scheme != "remote":
# NOTE: we can path either from command line or .dvc file,
@@ -386,9 +383,6 @@ class Output:
@property
def is_in_repo(self):
if self.fs.protocol != "local":
return False
if urlparse(self.def_path).scheme == "remote":
return False