mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 07:18:31 +01:00
exp queue: remove queued experiments(#7591)
fix: #7591 1. Add a new command `dvc queue` 2. Add two sub-command `dvc queue remove` and `dvc queue kill` 3. Add a unit test to test them Co-authored-by: Peter Rowlands (변기호) <[email protected]>
This commit is contained in:
committed by
Peter Rowlands (변기호)
co-authored by
Peter Rowlands
parent
4df5a1321d
commit
a6cb4eb72e
@@ -0,0 +1,63 @@
|
||||
from dvc.cli import parse_args
|
||||
from dvc.commands.queue.kill import CmdQueueKill
|
||||
from dvc.commands.queue.remove import CmdQueueRemove
|
||||
|
||||
|
||||
def test_experiments_remove(dvc, scm, mocker):
|
||||
cli_args = parse_args(
|
||||
[
|
||||
"queue",
|
||||
"remove",
|
||||
"--all",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdQueueRemove
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
m = mocker.patch(
|
||||
"dvc.repo.experiments.queue.local.LocalCeleryQueue.clear",
|
||||
return_value={},
|
||||
)
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with()
|
||||
|
||||
cli_args = parse_args(
|
||||
[
|
||||
"queue",
|
||||
"remove",
|
||||
"exp1",
|
||||
"exp2",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdQueueRemove
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
m = mocker.patch(
|
||||
"dvc.repo.experiments.queue.local.LocalCeleryQueue.remove",
|
||||
return_value={},
|
||||
)
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with(revs=["exp1", "exp2"])
|
||||
|
||||
|
||||
def test_experiments_kill(dvc, scm, mocker):
|
||||
cli_args = parse_args(
|
||||
[
|
||||
"queue",
|
||||
"kill",
|
||||
"exp1",
|
||||
"exp2",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdQueueKill
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
m = mocker.patch(
|
||||
"dvc.repo.experiments.queue.local.LocalCeleryQueue.kill",
|
||||
return_value={},
|
||||
)
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with(revs=["exp1", "exp2"])
|
||||
Reference in New Issue
Block a user