mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exp run: remove unsupported (repro only) arguments
This commit is contained in:
committed by
David de la Iglesia Castro
parent
5249207ceb
commit
d80c43135f
@@ -39,7 +39,7 @@ class CmdExperimentsRun(CmdRepro):
|
||||
reset=self.args.reset,
|
||||
tmp_dir=self.args.tmp_dir,
|
||||
machine=self.args.machine,
|
||||
**self._repro_kwargs,
|
||||
**self._common_kwargs,
|
||||
)
|
||||
|
||||
if self.args.metrics and results:
|
||||
|
||||
+34
-25
@@ -10,7 +10,9 @@ class CmdRepro(CmdBase):
|
||||
def run(self):
|
||||
from dvc.ui import ui
|
||||
|
||||
stages = self.repo.reproduce(**self._repro_kwargs)
|
||||
stages = self.repo.reproduce(
|
||||
**self._common_kwargs, **self._repro_kwargs
|
||||
)
|
||||
if len(stages) == 0:
|
||||
ui.write(CmdDataStatus.UP_TO_DATE_MSG)
|
||||
else:
|
||||
@@ -27,7 +29,7 @@ class CmdRepro(CmdBase):
|
||||
return 0
|
||||
|
||||
@property
|
||||
def _repro_kwargs(self):
|
||||
def _common_kwargs(self):
|
||||
return {
|
||||
"targets": self.args.targets,
|
||||
"single_item": self.args.single_item,
|
||||
@@ -36,12 +38,17 @@ class CmdRepro(CmdBase):
|
||||
"interactive": self.args.interactive,
|
||||
"pipeline": self.args.pipeline,
|
||||
"all_pipelines": self.args.all_pipelines,
|
||||
"run_cache": not self.args.no_run_cache,
|
||||
"no_commit": self.args.no_commit,
|
||||
"downstream": self.args.downstream,
|
||||
"recursive": self.args.recursive,
|
||||
"force_downstream": self.args.force_downstream,
|
||||
"pull": self.args.pull,
|
||||
}
|
||||
|
||||
@property
|
||||
def _repro_kwargs(self):
|
||||
return {
|
||||
"run_cache": not self.args.no_run_cache,
|
||||
"no_commit": self.args.no_commit,
|
||||
"glob": self.args.glob,
|
||||
}
|
||||
|
||||
@@ -110,15 +117,6 @@ def add_arguments(repro_parser):
|
||||
default=False,
|
||||
help="Reproduce all stages in the specified directory.",
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--no-run-cache",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help=(
|
||||
"Execute stage commands even if they have already been run with "
|
||||
"the same command/dependencies/outputs/etc before."
|
||||
),
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--force-downstream",
|
||||
action="store_true",
|
||||
@@ -126,12 +124,6 @@ def add_arguments(repro_parser):
|
||||
help="Reproduce all descendants of a changed stage even if their "
|
||||
"direct dependencies didn't change.",
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--no-commit",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Don't put files/directories into cache.",
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--downstream",
|
||||
action="store_true",
|
||||
@@ -147,12 +139,6 @@ def add_arguments(repro_parser):
|
||||
"from the run-cache."
|
||||
),
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--glob",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Allows targets containing shell-style wildcards.",
|
||||
)
|
||||
|
||||
|
||||
def add_parser(subparsers, parent_parser):
|
||||
@@ -166,5 +152,28 @@ def add_parser(subparsers, parent_parser):
|
||||
help=REPRO_HELP,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
# repro/exp run shared args
|
||||
add_arguments(repro_parser)
|
||||
# repro only args
|
||||
repro_parser.add_argument(
|
||||
"--no-run-cache",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help=(
|
||||
"Execute stage commands even if they have already been run with "
|
||||
"the same command/dependencies/outputs/etc before."
|
||||
),
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--no-commit",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Don't put files/directories into cache.",
|
||||
)
|
||||
repro_parser.add_argument(
|
||||
"--glob",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Allows targets containing shell-style wildcards.",
|
||||
)
|
||||
repro_parser.set_defaults(func=CmdRepro)
|
||||
|
||||
@@ -22,7 +22,7 @@ from dvc.stage import PipelineStage
|
||||
from tests.utils import ANY
|
||||
from tests.utils.asserts import called_once_with_subset
|
||||
|
||||
from .test_repro import default_arguments as repro_arguments
|
||||
from .test_repro import common_arguments as repro_arguments
|
||||
|
||||
|
||||
def test_experiments_apply(dvc, scm, mocker):
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
from dvc.cli import parse_args
|
||||
from dvc.commands.repro import CmdRepro
|
||||
|
||||
default_arguments = {
|
||||
common_arguments = {
|
||||
"all_pipelines": False,
|
||||
"downstream": False,
|
||||
"dry": False,
|
||||
"force": False,
|
||||
"run_cache": True,
|
||||
"interactive": False,
|
||||
"no_commit": False,
|
||||
"pipeline": False,
|
||||
"single_item": False,
|
||||
"recursive": False,
|
||||
"force_downstream": False,
|
||||
"pull": False,
|
||||
"glob": False,
|
||||
"targets": [],
|
||||
}
|
||||
repro_arguments = {
|
||||
"run_cache": True,
|
||||
"no_commit": False,
|
||||
"glob": False,
|
||||
}
|
||||
|
||||
|
||||
def test_default_arguments(dvc, mocker):
|
||||
@@ -24,14 +26,17 @@ def test_default_arguments(dvc, mocker):
|
||||
mocker.patch.object(cmd.repo, "reproduce")
|
||||
cmd.run()
|
||||
# pylint: disable=no-member
|
||||
cmd.repo.reproduce.assert_called_with(**default_arguments)
|
||||
cmd.repo.reproduce.assert_called_with(
|
||||
**common_arguments, **repro_arguments
|
||||
)
|
||||
|
||||
|
||||
def test_downstream(dvc, mocker):
|
||||
cmd = CmdRepro(parse_args(["repro", "--downstream"]))
|
||||
mocker.patch.object(cmd.repo, "reproduce")
|
||||
cmd.run()
|
||||
arguments = default_arguments.copy()
|
||||
arguments = common_arguments.copy()
|
||||
arguments.update(repro_arguments)
|
||||
arguments.update({"downstream": True})
|
||||
# pylint: disable=no-member
|
||||
cmd.repo.reproduce.assert_called_with(**arguments)
|
||||
|
||||
Reference in New Issue
Block a user