mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
import_db: set dependency.is_in_repo to false (#10504)
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user