Clean up remotes's exps (#6471)

* Clean up remotes's exps

fix #6006
1. add a new argument `--git-remote` to `dvc exp remove`
2. support remote a special remote exp
3. add tests for it
4. fix  #6421
5. add a test for #6421.
6. extract some functions from the `dvc pull`, `dvc push`, `dvc remove` to utils.
7. add a tests for this new util function `resolve_exp_ref`
8. add `__init__.py` to some test package for the pytest fail

Co-authored-by: Jorge Orpinel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dave Berenbaum <[email protected]>
This commit is contained in:
Gao
2021-09-05 10:06:07 +08:00
committed by GitHub
co-authored by Jorge Orpinel pre-commit-ci[bot] Dave Berenbaum
parent b99cd0be11
commit 4cc06339c8
13 changed files with 176 additions and 129 deletions
+10 -7
View File
@@ -253,15 +253,17 @@ def test_experiments_pull(dvc, scm, mocker):
@pytest.mark.parametrize(
"queue,clear_all",
[(True, False), (False, True)],
"queue,clear_all,remote",
[(True, False, None), (False, True, None), (False, False, True)],
)
def test_experiments_remove(dvc, scm, mocker, queue, clear_all):
def test_experiments_remove(dvc, scm, mocker, queue, clear_all, remote):
if queue:
args = "--queue"
args = ["--queue"]
if clear_all:
args = "--all"
cli_args = parse_args(["experiments", "remove", args])
args = ["--all"]
if remote:
args = ["--git-remote", "myremote", "exp-123", "exp-234"]
cli_args = parse_args(["experiments", "remove"] + args)
assert cli_args.func == CmdExperimentsRemove
cmd = cli_args.func(cli_args)
@@ -270,7 +272,8 @@ def test_experiments_remove(dvc, scm, mocker, queue, clear_all):
assert cmd.run() == 0
m.assert_called_once_with(
cmd.repo,
exp_names=[],
exp_names=["exp-123", "exp-234"] if remote else [],
queue=queue,
clear_all=clear_all,
remote="myremote" if remote else None,
)