repo.check_graph: rename method (#8800)

This commit is contained in:
skshetry
2023-01-12 16:03:51 +05:45
committed by GitHub
parent 30ec1cf5e9
commit 3bcd683677
4 changed files with 13 additions and 6 deletions
+5 -2
View File
@@ -3,7 +3,7 @@ import os
from collections import defaultdict
from contextlib import contextmanager
from functools import wraps
from typing import TYPE_CHECKING, Callable, Optional
from typing import TYPE_CHECKING, Callable, Iterable, Optional
from funcy import cached_property
@@ -18,6 +18,7 @@ if TYPE_CHECKING:
from dvc.fs import FileSystem
from dvc.repo.scm_context import SCMContext
from dvc.scm import Base
from dvc.stage import Stage
logger = logging.getLogger(__name__)
@@ -241,7 +242,9 @@ class Repo:
return Index.from_repo(self)
def ensure_graph_correctness_with(self, stages=None, callback=None):
def check_graph(
self, stages: Iterable["Stage"] = None, callback: Callable = None
) -> None:
if not getattr(self, "_skip_graph_checks", False):
new = self.index.update(stages)
if callable(callback):
+1 -1
View File
@@ -180,7 +180,7 @@ def add( # noqa: C901
with translate_graph_error(stages), ui.status(msg) as status:
# remove existing stages that are to-be replaced with these
# new stages for the graph checks.
repo.ensure_graph_correctness_with(
repo.check_graph(
stages=stages, callback=lambda: status.update("Checking graph")
)
+6 -2
View File
@@ -1,17 +1,21 @@
import os
from typing import TYPE_CHECKING
from dvc.exceptions import InvalidArgumentError, OutputDuplicationError
from dvc.repo.scm_context import scm_context
from dvc.utils import relpath, resolve_output, resolve_paths
from dvc.utils.fs import path_isin
if TYPE_CHECKING:
from . import Repo
from . import locked
@locked
@scm_context
def imp_url( # noqa: C901
self,
self: "Repo",
url,
out=None,
fname=None,
@@ -78,7 +82,7 @@ def imp_url( # noqa: C901
dvcfile.remove()
try:
self.ensure_graph_correctness_with(stages={stage})
self.check_graph(stages={stage})
except OutputDuplicationError as exc:
raise OutputDuplicationError( # noqa: B904
exc.output, set(exc.stages) - {stage}
+1 -1
View File
@@ -185,7 +185,7 @@ class StageLoad:
check_stage_exists(self.repo, stage, stage.path)
self.repo.ensure_graph_correctness_with(stages={stage})
self.repo.check_graph(stages={stage})
restore_fields(stage)
return stage