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

Print the status of finished jobs #2801

Merged
merged 6 commits into from
Jul 29, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add some tests.
serhiy-storchaka committed Jul 28, 2022
commit 777c045cf5d546dcaf76766bd1c870e96ddee925
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
√ Http URL: http://local.host.test/
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
√ Http URL: http://local.host.test/
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◢ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◢ [2.0 sec] Status: running reason
- Status: pending Pulling ◢ [2.0 sec]× Status: cancelled reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◣ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◣ [2.0 sec]× Status: failed reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◤ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◤ [2.0 sec]- Status: pending reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◥ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◥ [2.0 sec]√ Status: running reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◢ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◢ [2.0 sec]√ Status: succeeded reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Status: pending Pulling- Status: pending Pulling ◣ [2.0 sec]- Status: pending Pulling
- Status: pending Pulling ◣ [2.0 sec]- Status: suspended reason
16 changes: 12 additions & 4 deletions neuro-cli/tests/unit/formatters/test_jobs_formatters.py
Original file line number Diff line number Diff line change
@@ -248,8 +248,13 @@ def test_tty_begin_with_name(self, rich_cmp: Any, new_console: _NewConsole) -> N
@pytest.mark.skipif(
sys.platform == "win32", reason="On Windows spinner uses another characters set"
)
@pytest.mark.parametrize("status", sorted(JobStatus.items()))
def test_tty_step(
self, rich_cmp: Any, new_console: _NewConsole, monkeypatch: Any
self,
rich_cmp: Any,
new_console: _NewConsole,
monkeypatch: Any,
status: JobStatus,
) -> None:
monkeypatch.setattr(
JobStartProgress, "time_factory", itertools.count(10).__next__
@@ -258,13 +263,16 @@ def test_tty_step(
with JobStartProgress.create(console, quiet=False) as progress:
progress.step(self.make_job(JobStatus.PENDING, "Pulling", description=""))
progress.step(self.make_job(JobStatus.PENDING, "Pulling", description=""))
progress.step(self.make_job(JobStatus.RUNNING, "reason", description=""))
progress.step(self.make_job(status, "reason", description=""))
rich_cmp(console)

def test_tty_end(self, rich_cmp: Any, new_console: _NewConsole) -> None:
@pytest.mark.parametrize("status", sorted(JobStatus.items()))
def test_tty_end(
self, rich_cmp: Any, new_console: _NewConsole, status: JobStatus
) -> None:
console = new_console(tty=True, color=True)
with JobStartProgress.create(console, quiet=False) as progress:
progress.end(self.make_job(JobStatus.RUNNING, ""))
progress.end(self.make_job(status, "reason"))
rich_cmp(console)

def test_tty_end_with_life_span(