mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 15:28:28 +01:00
exp queue: monitor queue status (#7590)
fix: #7590 1. Add two new command `queue status` and `queue attach` 2. Add unit test for the CLI 3. Make `Running` exps can be found by `get_queue_entry_by_names`
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
6b8c87b58a
commit
3d0ee0d202
@@ -1,7 +1,9 @@
|
||||
from dvc.cli import parse_args
|
||||
from dvc.commands.queue.attach import CmdQueueAttach
|
||||
from dvc.commands.queue.kill import CmdQueueKill
|
||||
from dvc.commands.queue.remove import CmdQueueRemove
|
||||
from dvc.commands.queue.start import CmdQueueStart
|
||||
from dvc.commands.queue.status import CmdQueueStatus
|
||||
from dvc.commands.queue.stop import CmdQueueStop
|
||||
|
||||
|
||||
@@ -95,3 +97,43 @@ def test_experiments_stop(dvc, scm, mocker):
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with(kill=True)
|
||||
|
||||
|
||||
def test_experiments_status(dvc, scm, mocker):
|
||||
cli_args = parse_args(
|
||||
[
|
||||
"queue",
|
||||
"status",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdQueueStatus
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
m = mocker.patch(
|
||||
"dvc.repo.experiments.queue.local.LocalCeleryQueue.status",
|
||||
)
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with()
|
||||
|
||||
|
||||
def test_experiments_attach(dvc, scm, mocker):
|
||||
cli_args = parse_args(
|
||||
[
|
||||
"queue",
|
||||
"attach",
|
||||
"exp1",
|
||||
"-e",
|
||||
"utf8",
|
||||
]
|
||||
)
|
||||
assert cli_args.func == CmdQueueAttach
|
||||
|
||||
cmd = cli_args.func(cli_args)
|
||||
m = mocker.patch(
|
||||
"dvc.repo.experiments.queue.local.LocalCeleryQueue.attach",
|
||||
return_value={},
|
||||
)
|
||||
|
||||
assert cmd.run() == 0
|
||||
m.assert_called_once_with(rev="exp1", encoding="utf8")
|
||||
|
||||
Reference in New Issue
Block a user