mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 15:28:27 +01:00
reproduce: remove callback (#9354)
Callback was added for working around scm_context, since we don't use it, we don't need callback now.
This commit is contained in:
@@ -7,6 +7,7 @@ from contextlib import contextmanager
|
||||
from dataclasses import asdict, dataclass
|
||||
from enum import IntEnum
|
||||
from functools import partial
|
||||
from itertools import chain
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
@@ -261,10 +262,14 @@ class BaseExecutor(ABC):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _get_top_level_paths(cls, repo: "Repo") -> Iterable["str"]:
|
||||
yield from _collect_top_level_metrics(repo)
|
||||
yield from _collect_top_level_params(repo)
|
||||
yield from repo.index._plot_sources # pylint: disable=protected-access
|
||||
def _get_top_level_paths(cls, repo: "Repo") -> List["str"]:
|
||||
return list(
|
||||
chain(
|
||||
_collect_top_level_metrics(repo),
|
||||
_collect_top_level_params(repo),
|
||||
repo.index._plot_sources, # pylint: disable=protected-access
|
||||
)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def save(
|
||||
@@ -544,20 +549,16 @@ class BaseExecutor(ABC):
|
||||
repro_force or checkpoint_reset,
|
||||
)
|
||||
|
||||
def after_repro():
|
||||
paths = list(cls._get_top_level_paths(dvc))
|
||||
if paths:
|
||||
logger.debug("Staging top-level files: %s", paths)
|
||||
dvc.scm_context.add(paths)
|
||||
|
||||
stages = dvc_reproduce(
|
||||
dvc,
|
||||
*args,
|
||||
on_unchanged=filter_pipeline,
|
||||
checkpoint_func=checkpoint_func,
|
||||
after_repro_callback=after_repro,
|
||||
**kwargs,
|
||||
)
|
||||
if paths := cls._get_top_level_paths(dvc):
|
||||
logger.debug("Staging top-level files: %s", paths)
|
||||
dvc.scm_context.add(paths)
|
||||
|
||||
exp_hash = cls.hash_exp(stages)
|
||||
if not repro_dry:
|
||||
|
||||
@@ -76,13 +76,12 @@ def _track_stage(stage: "Stage") -> None:
|
||||
|
||||
@locked
|
||||
@scm_context
|
||||
def reproduce( # noqa: C901, PLR0912
|
||||
def reproduce( # noqa: C901
|
||||
self: "Repo",
|
||||
targets=None,
|
||||
recursive=False,
|
||||
pipeline=False,
|
||||
all_pipelines=False,
|
||||
after_repro_callback=None,
|
||||
**kwargs,
|
||||
):
|
||||
from .graph import get_pipeline, get_pipelines
|
||||
@@ -126,10 +125,7 @@ def reproduce( # noqa: C901, PLR0912
|
||||
)
|
||||
)
|
||||
|
||||
result = _reproduce_stages(self.index.graph, list(stages), **kwargs)
|
||||
if callable(after_repro_callback):
|
||||
after_repro_callback()
|
||||
return result
|
||||
return _reproduce_stages(self.index.graph, list(stages), **kwargs)
|
||||
|
||||
|
||||
def _reproduce_stages( # noqa: C901
|
||||
|
||||
Reference in New Issue
Block a user