mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +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.def_path = None # type: ignore[assignment]
|
||||||
self.info = info or {}
|
self.info = info or {}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_in_repo(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class DbDependency(AbstractDependency):
|
class DbDependency(AbstractDependency):
|
||||||
PARAM_CONNECTION = "connection"
|
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)
|
return self.db_info.get(self.PARAM_QUERY) or self.db_info.get(self.PARAM_TABLE)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{}:{}".format(
|
return "{}: {}".format(
|
||||||
self.__class__.__name__, "".join(f"{k}=={v}" for k, v in self.info.items())
|
self.__class__.__name__, "".join(f"{k}={v}" for k, v in self.info.items())
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ class SerializableExp:
|
|||||||
Params, metrics, deps, outs are filled via repo fs/index, all other fields
|
Params, metrics, deps, outs are filled via repo fs/index, all other fields
|
||||||
should be passed via kwargs.
|
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()
|
rev = rev or repo.get_rev()
|
||||||
assert rev
|
assert rev
|
||||||
@@ -68,7 +73,10 @@ class SerializableExp:
|
|||||||
nfiles=dep.meta.nfiles if dep.meta else None,
|
nfiles=dep.meta.nfiles if dep.meta else None,
|
||||||
)
|
)
|
||||||
for dep in repo.index.deps
|
for dep in repo.index.deps
|
||||||
if not isinstance(dep, (ParamsDependency, RepoDependency))
|
if not isinstance(
|
||||||
|
dep,
|
||||||
|
(ParamsDependency, RepoDependency, DatasetDependency, DbDependency),
|
||||||
|
)
|
||||||
},
|
},
|
||||||
outs={
|
outs={
|
||||||
relpath(out.fs_path, repo.root_dir): ExpOut(
|
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):
|
def _pull_missing_deps(stage):
|
||||||
|
from dvc.dependency import DatasetDependency, DbDependency
|
||||||
|
|
||||||
for dep in stage.deps:
|
for dep in stage.deps:
|
||||||
|
if isinstance(dep, (DatasetDependency, DbDependency)):
|
||||||
|
continue
|
||||||
if not dep.exists:
|
if not dep.exists:
|
||||||
stage.repo.pull(dep.def_path)
|
stage.repo.pull(dep.def_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user