From 7cc0d0e0d188752829f31ecdc34d9cc4459807f1 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Wed, 25 Sep 2024 20:23:59 +0800 Subject: [PATCH] fix: do not initialize cloud client when building bento (#4998) Signed-off-by: Frost Ming --- src/bentoml_cli/bentos.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bentoml_cli/bentos.py b/src/bentoml_cli/bentos.py index 8afd40eee2a..307e7d701ce 100644 --- a/src/bentoml_cli/bentos.py +++ b/src/bentoml_cli/bentos.py @@ -395,7 +395,6 @@ def push( help="Platform to build for", type=click.Choice(ALLOWED_PLATFORMS), ) - @inject def build( # type: ignore (not accessed) build_ctx: str, bentofile: str, @@ -407,7 +406,6 @@ def build( # type: ignore (not accessed) threads: int, containerize: bool, platform: str | None, - _cloud_client: BentoCloudClient = Provide[BentoMLContainer.bentocloud_client], ): """Build a new Bento from current directory.""" from bentoml._internal.configuration import set_quiet_mode @@ -462,7 +460,8 @@ def build( # type: ignore (not accessed) if push: if not get_quiet_mode(): rich.print(f"\n[magenta]Pushing {bento} to BentoCloud...[/]") - _cloud_client.bento.push(bento, force=force, threads=threads) + cloud_client = BentoMLContainer.bentocloud_client.get() + cloud_client.bento.push(bento, force=force, threads=threads) elif containerize: backend: DefaultBuilder = t.cast( "DefaultBuilder", os.getenv("BENTOML_CONTAINERIZE_BACKEND", "docker")