Skip to content

Commit

Permalink
fix: stop live refresh before showing final status
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Jun 18, 2024
1 parent ba22c4a commit cdc238b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bentoml/_internal/cloud/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ def start(self) -> None:

def stop(self) -> None:
"""Stop live updating."""
self._live.stop()
if self._spinner_task_id is not None:
self._spinner_progress.stop_task(self._spinner_task_id)
self._spinner_progress.update(self._spinner_task_id, visible=False)
self._spinner_task_id = None
self._live.stop()

def log(self, message: str) -> None:
"""Add a log message line."""
Expand Down
9 changes: 6 additions & 3 deletions src/bentoml/_internal/cloud/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,11 @@ def stop_tail_thread():
)
tail_thread.start()

if (
status.status == DeploymentStatus.Running.value
or status.status == DeploymentStatus.ScaledToZero.value
if status.status in (
DeploymentStatus.Running.value,
DeploymentStatus.ScaledToZero.value,
):
spinner.stop()
spinner.console.print(
f'✅ [bold green] Deployment "{self.name}" is ready:[/] {self.admin_console}'
)
Expand All @@ -595,13 +596,15 @@ def stop_tail_thread():
DeploymentStatus.Terminating.value,
DeploymentStatus.Unhealthy.value,
]:
spinner.stop()
spinner.console.print(
f'🚨 [bold red]Deployment "{self.name}" is not ready. Current status: "{status.status}"[/]'
)
return

time.sleep(check_interval)

spinner.stop()
spinner.console.print(
f'🚨 [bold red]Time out waiting for Deployment "{self.name}" ready[/]'
)
Expand Down

0 comments on commit cdc238b

Please sign in to comment.