mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* repro: introduce --keep-going/--ignore to continue on error `-k`/`--keep-going` will skip all dependents of a stage if it fails. It'll still try to reproduce the other dependencies of the pending targets, before it exits with a non-zero status. `--ignore-errors` will treat any error during stage execution as a success, and will continue executing other dependencies as if it succeeded. Exits with 0 even on failure. Also fixes: * --force-downstream used to force everything even if one upstream nodes changed. This used to work when we supported a single targets, but there could be independent pipelines, so we should not force everything if any node changes. Now we'll force reproduce the stage only if one of its dependency changed upstream or it's upstream node was also forced. * Makes `--downstream` more correct, in relation to `--allow-missing` and `--pull`. Now we use an active graph for downstream/upstream logic instead of a subgraph. Note that this does not affect the downstream logic though, as dvc always goes downstream, so subgraph was no different than active graph. The subgraph only did not have the upstream nodes. * add tests * add spacing in the message
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from dvc.cli import parse_args
|
|
from dvc.commands.repro import CmdRepro
|
|
|
|
common_arguments = {
|
|
"all_pipelines": False,
|
|
"downstream": False,
|
|
"dry": False,
|
|
"force": False,
|
|
"interactive": False,
|
|
"pipeline": False,
|
|
"single_item": False,
|
|
"recursive": False,
|
|
"force_downstream": False,
|
|
"pull": False,
|
|
"allow_missing": False,
|
|
"targets": [],
|
|
"on_error": "fail",
|
|
}
|
|
repro_arguments = {
|
|
"run_cache": True,
|
|
"no_commit": False,
|
|
"glob": False,
|
|
}
|
|
|
|
|
|
def test_default_arguments(dvc, mocker):
|
|
cmd = CmdRepro(parse_args(["repro"]))
|
|
mocker.patch.object(cmd.repo, "reproduce")
|
|
cmd.run()
|
|
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 = common_arguments.copy()
|
|
arguments.update(repro_arguments)
|
|
arguments.update({"downstream": True})
|
|
cmd.repo.reproduce.assert_called_with(**arguments)
|