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

fix: use emoji code instead of emoji char #5157

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/bentoml/_internal/cloud/bento.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ def filter_(
)
except Exception as e: # pylint: disable=broad-except
self.spinner.log(
f'[bold red]🚨 Failed to upload bento "{bento.tag}"'
f'[bold red]:police_car_light: Failed to upload bento "{bento.tag}"'
)
raise e
self.spinner.log(
f'[bold green] Successfully pushed bento "{bento.tag}"'
f'[bold green]:white_check_mark: Successfully pushed bento "{bento.tag}"'
)
return
finish_req = FinishUploadSchema(
Expand Down
42 changes: 24 additions & 18 deletions src/bentoml/_internal/cloud/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def ensure_bento(
build_ctx=project_path, bare=bare, _bento_store=_bento_store, reload=reload
)
if cli:
rich.print(f"🍱 Built bento [green]{bento_obj.info.tag}[/]")
rich.print(f":bento: Built bento [green]{bento_obj.info.tag}[/]")
if push:
bento_api.push(bento=bento_obj, bare=bare)
return bento_obj
Expand Down Expand Up @@ -561,7 +561,7 @@ def tail_image_builder_logs() -> None:
if pod is None:
if time.time() - started_at > timeout:
spinner.console.print(
"🚨 [bold red]Time out waiting for image builder pod created[/bold red]"
":police_car_light: [bold red]Time out waiting for image builder pod created[/bold red]"
)
return
if stop_tail_event.wait(check_interval):
Expand All @@ -571,7 +571,7 @@ def tail_image_builder_logs() -> None:
break
if time.time() - started_at > wait_pod_timeout:
spinner.console.print(
"🚨 [bold red]Time out waiting for image builder pod running[/bold red]"
":police_car_light: [bold red]Time out waiting for image builder pod running[/bold red]"
)
return
if stop_tail_event.wait(check_interval):
Expand All @@ -591,25 +591,29 @@ def tail_image_builder_logs() -> None:
decoded_str = decoded_bytes.decode("utf-8")
if is_first:
is_first = False
spinner.update("🚧 Image building...")
spinner.update(":construction: Image building...")
spinner.stop()
console.print(decoded_str, end="", markup=False, highlight=False)

tail_thread: Thread | None = None

try:
status: DeploymentState | None = None
spinner.update(f'🔄 Waiting for deployment "{self.name}" to be ready...')
spinner.update(
f':hourglass: Waiting for deployment "{self.name}" to be ready...'
)
while time.time() - start_time < timeout:
for _ in range(3):
try:
new_status = self.get_status()
break
except TimeoutException:
spinner.update("⚠️ Unable to get deployment status, retrying...")
spinner.update(
":warning: Unable to get deployment status, retrying..."
)
else:
spinner.log(
"🚨 [bold red]Unable to contact the server, but the deployment is created. "
":police_car_light: [bold red]Unable to contact the server, but the deployment is created. "
"You can check the status on the bentocloud website.[/bold red]"
)
return 1
Expand All @@ -618,7 +622,7 @@ def tail_image_builder_logs() -> None:
): # on status change
status = new_status
spinner.update(
f'🔄 Waiting for deployment "{self.name}" to be ready. Current status: "{status.status}"'
f':hourglass: Waiting for deployment "{self.name}" to be ready. Current status: "{status.status}"'
)
if status.status == DeploymentStatus.ImageBuilding.value:
if tail_thread is None:
Expand All @@ -643,7 +647,7 @@ def tail_image_builder_logs() -> None:
]:
spinner.stop()
console.print(
f'🚨 [bold red]Deployment "{self.name}" is not ready. Current status: "{status.status}"[/]'
f':police_car_light: [bold red]Deployment "{self.name}" is not ready. Current status: "{status.status}"[/]'
)
return 1
if status.status in (
Expand All @@ -652,15 +656,15 @@ def tail_image_builder_logs() -> None:
):
spinner.stop()
console.print(
f' [bold green] Deployment "{self.name}" is ready:[/] {self.admin_console}'
f':white_check_mark: [bold green] Deployment "{self.name}" is ready:[/] {self.admin_console}'
)
break

time.sleep(check_interval)
else:
spinner.stop()
console.print(
f'🚨 [bold red]Time out waiting for Deployment "{self.name}" ready[/]'
f':police_car_light: [bold red]Time out waiting for Deployment "{self.name}" ready[/]'
)
return 1

Expand Down Expand Up @@ -730,7 +734,7 @@ def _init_deployment_files(
check_interval = 5
start_time = time.time()
console = spinner.console
spinner_text = "🔄 Preparing codespace - status: [green]{}[/]"
spinner_text = ":hourglass: Preparing codespace - status: [green]{}[/]"
status = self.get_status(False).status
while time.time() - start_time < timeout:
spinner.update(spinner_text.format(status))
Expand Down Expand Up @@ -871,7 +875,7 @@ def is_bento_changed(bento_info: Bento) -> bool:

spinner = Spinner(console=console)
needs_update = is_bento_changed(bento_info)
spinner.log(f"💻 View Dashboard: {self.admin_console}")
spinner.log(f":laptop_computer: View Dashboard: {self.admin_console}")
endpoint_url: str | None = None
stop_event = Event()
try:
Expand All @@ -882,10 +886,12 @@ def is_bento_changed(bento_info: Bento) -> bool:
while True:
stop_event.clear()
if needs_update:
console.print(" [green bold]Bento change detected[/]")
spinner.update("🔄 Pushing Bento to BentoCloud")
console.print(":sparkles: [green bold]Bento change detected[/]")
spinner.update(":hourglass: Pushing Bento to BentoCloud")
bento_api._do_push_bento(bento_info, upload_id, bare=True) # type: ignore
spinner.update("🔄 Updating codespace with new configuration")
spinner.update(
":hourglass: Updating codespace with new configuration"
)
update_config = DeploymentConfigParameters(
bento=str(bento_info.tag),
name=self.name,
Expand Down Expand Up @@ -920,7 +926,7 @@ def is_bento_changed(bento_info: Bento) -> bool:
)
except Exception as e:
spinner.console.print(
f"🚨 [bold red]Failed to build Bento: {e}[/]"
f":police_car_light: [bold red]Failed to build Bento: {e}[/]"
)
else:
assert isinstance(bento_info, Bento)
Expand Down Expand Up @@ -980,7 +986,7 @@ def is_bento_changed(bento_info: Bento) -> bool:
DeploymentStatus.Unhealthy.value,
]:
console.print(
f'🚨 [bold red]Codespace "{self.name}" aborted. Current status: "{status}"[/]'
f':police_car_light: [bold red]Codespace "{self.name}" aborted. Current status: "{status}"[/]'
)
return
except KeyboardInterrupt:
Expand Down
4 changes: 2 additions & 2 deletions src/bentoml/_internal/cloud/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def io_cb(x: int):
)
except Exception as e: # pylint: disable=broad-except
self.spinner.log(
f'[bold red]🚨 Failed to upload model "{model.tag}"'
f'[bold red]:police_car_light: Failed to upload model "{model.tag}"'
)
raise e
self.spinner.log(
f'[bold green] Successfully pushed model "{model.tag}"'
f'[bold green]:white_check_mark: Successfully pushed model "{model.tag}"'
)
return
finish_req = FinishUploadSchema(
Expand Down
23 changes: 14 additions & 9 deletions src/bentoml_cli/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,27 @@ def login(endpoint: str, api_token: str) -> None: # type: ignore (not accessed)
default=True,
):
if webbrowser.open_new_tab(authURL):
rich.print(f"✅ Opened [blue]{authURL}[/] in your web browser.")
rich.print(
f":white_check_mark: Opened [blue]{authURL}[/] in your web browser."
)
else:
rich.print(
f"🚨 Failed to open browser. Try create a new API token at {baseURL} or Open [blue]{authURL}[/] yourself"
f":police_car_light: Failed to open browser. Try create a new API token at {baseURL} or Open [blue]{authURL}[/] yourself"
)
else:
rich.print(f"🫱 Open [blue]{authURL}[/] yourself...")
rich.print(
f":backhand_index_pointing_right: Open [blue]{authURL}[/] yourself..."
)
try:
rich.print("🔒 Waiting for authentication...")
rich.print(":hourglass: Waiting for authentication...")
code = callback_server.wait_indefinitely_for_code()
if code is None:
raise ValueError(
"No code could be obtained from browser callback page"
)
api_token = code
except Exception:
rich.print("🚨 Error accquiring token from web browser")
rich.print(":police_car_light: Error accquiring token from web browser")
return
elif choice == "paste":
api_token = click.prompt(
Expand Down Expand Up @@ -123,20 +127,21 @@ def login(endpoint: str, api_token: str) -> None: # type: ignore (not accessed)

ctx.save()
rich.print(
f" Configured BentoCloud credentials (current-context: {ctx.name})"
f":white_check_mark: Configured BentoCloud credentials (current-context: {ctx.name})"
)
rich.print(
f" Logged in as [blue]{user.email}[/] at [blue]{org.name}[/] organization"
f":white_check_mark: Logged in as [blue]{user.email}[/] at [blue]{org.name}[/] organization"
)
except CloudRESTApiClientError as e:
if e.error_code == 401:
rich.print(
f"🚨 Error validating token: HTTP 401: Bad credentials ({endpoint}/api-token)",
f":police_car_light: Error validating token: HTTP 401: Bad credentials ({endpoint}/api-token)",
file=sys.stderr,
)
else:
rich.print(
f"🚨 Error validating token: HTTP {e.error_code}", file=sys.stderr
f":police_car_light: Error validating token: HTTP {e.error_code}",
file=sys.stderr,
)


Expand Down
4 changes: 2 additions & 2 deletions src/bentoml_cli/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ def create_deployment(
deployment_config_params=config_params
)
spinner.log(
f' Created deployment "{deployment.name}" in cluster "{deployment.cluster}"'
f':white_check_mark: Created deployment "{deployment.name}" in cluster "{deployment.cluster}"'
)
spinner.log(f"💻 View Dashboard: {deployment.admin_console}")
spinner.log(f":laptop_computer: View Dashboard: {deployment.admin_console}")
if wait:
spinner.update(
"[bold blue]Waiting for deployment to be ready, you can use --no-wait to skip this process[/]",
Expand Down
Loading