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

feat(bentocloud): deployment v2 api client + cli #4335

Merged
merged 3 commits into from
Jan 3, 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: 3 additions & 1 deletion src/bentoml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
from . import server # Server API
from . import monitoring # Monitoring API
from . import cloud # Cloud API
from . import deployment # deployment API

# isort: on
from _bentoml_impl.client import AsyncHTTPClient
Expand Down Expand Up @@ -166,7 +167,7 @@
exceptions = _LazyLoader("bentoml.exceptions", globals(), "bentoml.exceptions")
monitoring = _LazyLoader("bentoml.monitoring", globals(), "bentoml.monitoring")
cloud = _LazyLoader("bentoml.cloud", globals(), "bentoml.cloud")
Haivilo marked this conversation as resolved.
Show resolved Hide resolved

deployment = _LazyLoader("bentoml.deployment", globals(), "bentoml.deployment")
del _LazyLoader

_NEW_SDK_ATTRS = [
Expand Down Expand Up @@ -258,6 +259,7 @@ def __getattr__(name: str) -> Any:
# integrations
"ray",
"cloud",
"deployment",
"triton",
"monitor",
"load_config",
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/_internal/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .base import CloudClient as CloudClient
from .bentocloud import BentoCloudClient as BentoCloudClient
from .deployment import Resource as Resource
Haivilo marked this conversation as resolved.
Show resolved Hide resolved
from .yatai import YataiClient as YataiClient
51 changes: 27 additions & 24 deletions src/bentoml/_internal/cloud/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,33 @@ def write(self, data: bytes) -> t.Any: # type: ignore # python buffer types ar


class CloudClient(ABC):
log_progress = Progress(TextColumn("{task.description}"))

spinner_progress = Progress(
TextColumn(" "),
TimeElapsedColumn(),
TextColumn("[bold purple]{task.fields[action]}"),
SpinnerColumn("simpleDots"),
)

transmission_progress = Progress(
TextColumn("[bold blue]{task.description}", justify="right"),
BarColumn(bar_width=None),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
DownloadColumn(),
"•",
TransferSpeedColumn(),
"•",
TimeRemainingColumn(),
)

progress_group = Group(
Panel(Group(log_progress, spinner_progress)), transmission_progress
)
# Moved atrributes to __init__ because otherwise it will keep all the log when running SDK.
def __init__(self):
self.log_progress = Progress(TextColumn("{task.description}"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to @aarnphm: Here once migrate to tqdm.


self.spinner_progress = Progress(
TextColumn(" "),
TimeElapsedColumn(),
TextColumn("[bold purple]{task.fields[action]}"),
SpinnerColumn("simpleDots"),
)

self.transmission_progress = Progress(
TextColumn("[bold blue]{task.description}", justify="right"),
BarColumn(bar_width=None),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
DownloadColumn(),
"•",
TransferSpeedColumn(),
"•",
TimeRemainingColumn(),
)

self.progress_group = Group(
Panel(Group(self.log_progress, self.spinner_progress)),
self.transmission_progress,
)

@contextmanager
def spin(self, *, text: str):
Expand Down
Loading