Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exp run: remove exp reset in favor of exp run --reset #5442

Merged
merged 2 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions dvc/command/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,35 +914,11 @@ def add_parser(subparsers, parent_parser):
metavar="<experiment_rev>",
)
experiments_run_parser.add_argument(
"--reset", action="store_true", help=argparse.SUPPRESS,
)
experiments_run_parser.set_defaults(func=CmdExperimentsRun)

EXPERIMENTS_RESET_HELP = "Reset and restart checkpoint experiments."
experiments_reset_parser = experiments_subparsers.add_parser(
"reset",
parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_RESET_HELP, "exp/reset"),
help=EXPERIMENTS_RESET_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
experiments_reset_parser.add_argument(
"-r",
"--rev",
type=str,
default=None,
dest="checkpoint_resume",
help=argparse.SUPPRESS,
)
_add_run_common(experiments_reset_parser)
experiments_reset_parser.add_argument(
"--reset",
action="store_const",
const=True,
default=True,
help=argparse.SUPPRESS,
action="store_true",
help="Reset existing checkpoints and restart the experiment.",
)
experiments_reset_parser.set_defaults(func=CmdExperimentsRun)
experiments_run_parser.set_defaults(func=CmdExperimentsRun)

EXPERIMENTS_GC_HELP = "Garbage collect unneeded experiments."
EXPERIMENTS_GC_DESCRIPTION = (
Expand Down
9 changes: 3 additions & 6 deletions tests/unit/command/test_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ def test_experiments_show(dvc, scm, mocker):
)


@pytest.mark.parametrize(
"args, reset", [(["exp", "run"], False), (["exp", "reset"], True)],
)
def test_experiments_run(dvc, scm, mocker, args, reset):
def test_experiments_run(dvc, scm, mocker):
default_arguments = {
"params": [],
"name": None,
Expand All @@ -98,11 +95,11 @@ def test_experiments_run(dvc, scm, mocker, args, reset):
"jobs": None,
"tmp_dir": False,
"checkpoint_resume": None,
"reset": reset,
"reset": False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a "reset": True case needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command unit tests are mainly for making sure the CLI parsing works. The actual reset=true/false functionality is tested in tests/func/experiments.

}
default_arguments.update(repro_arguments)

cmd = CmdExperimentsRun(parse_args(args))
cmd = CmdExperimentsRun(parse_args(["exp", "run"]))
mocker.patch.object(cmd.repo, "reproduce")
mocker.patch.object(cmd.repo.experiments, "run")
cmd.run()
Expand Down