Skip to content

Commit

Permalink
fix: do not raise deployment pods not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Jul 18, 2024
1 parent a066a24 commit 3791fde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bentoml/_internal/cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def get_deployment_image_builder_pod(
) -> KubePodSchema | None:
pods = self.list_deployment_pods(name, cluster=cluster)
if not pods:
raise NotFound(f"Deployment {name} pods is not found")
return None
for pod in pods:
if pod.labels.get("yatai.ai/is-bento-image-builder") == "true":
return pod
Expand Down
12 changes: 12 additions & 0 deletions src/bentoml/_internal/cloud/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,17 +537,29 @@ def tail_image_builder_logs(stop_spinner: t.Callable[[], None]):
nonlocal ws_session

cloud_rest_client = get_rest_api_client(self._context)
start_time = time.time()
wait_pod_timeout = 60 * 10
pod: KubePodSchema | None = None
while True:
pod = cloud_rest_client.v2.get_deployment_image_builder_pod(
self.name, self.cluster
)
if pod is None:
if time.time() - start_time > timeout:
console.print(
"🚨 [bold red]Time out waiting for image builder pod created[/bold red]"
)
return
if stop_tail_event.wait(check_interval):
return
continue
if pod.pod_status.status == "Running":
break
if time.time() - start_time > wait_pod_timeout:
console.print(
"🚨 [bold red]Time out waiting for image builder pod running[/bold red]"
)
return
if stop_tail_event.wait(check_interval):
return
if pod is None:
Expand Down

0 comments on commit 3791fde

Please sign in to comment.