import_db: set dependency.is_in_repo to false (#10504)

This commit is contained in:
skshetry
2024-08-06 14:02:24 +05:45
committed by GitHub
parent 284d83f390
commit 1bef0da4fb
3 changed files with 20 additions and 4 deletions
+6 -2
View File
@@ -44,6 +44,10 @@ class AbstractDependency(Dependency):
self.def_path = None # type: ignore[assignment]
self.info = info or {}
@property
def is_in_repo(self):
return False
class DbDependency(AbstractDependency):
PARAM_CONNECTION = "connection"
@@ -70,8 +74,8 @@ class DbDependency(AbstractDependency):
return self.db_info.get(self.PARAM_QUERY) or self.db_info.get(self.PARAM_TABLE)
def __repr__(self):
return "{}:{}".format(
self.__class__.__name__, "".join(f"{k}=={v}" for k, v in self.info.items())
return "{}: {}".format(
self.__class__.__name__, "".join(f"{k}={v}" for k, v in self.info.items())
)
def __str__(self):
+10 -2
View File
@@ -50,7 +50,12 @@ class SerializableExp:
Params, metrics, deps, outs are filled via repo fs/index, all other fields
should be passed via kwargs.
"""
from dvc.dependency import ParamsDependency, RepoDependency
from dvc.dependency import (
DatasetDependency,
DbDependency,
ParamsDependency,
RepoDependency,
)
rev = rev or repo.get_rev()
assert rev
@@ -68,7 +73,10 @@ class SerializableExp:
nfiles=dep.meta.nfiles if dep.meta else None,
)
for dep in repo.index.deps
if not isinstance(dep, (ParamsDependency, RepoDependency))
if not isinstance(
dep,
(ParamsDependency, RepoDependency, DatasetDependency, DbDependency),
)
},
outs={
relpath(out.fs_path, repo.root_dir): ExpOut(
+4
View File
@@ -154,7 +154,11 @@ def cmd_run(stage, dry=False, run_env=None):
def _pull_missing_deps(stage):
from dvc.dependency import DatasetDependency, DbDependency
for dep in stage.deps:
if isinstance(dep, (DatasetDependency, DbDependency)):
continue
if not dep.exists:
stage.repo.pull(dep.def_path)