From cf861d63771d5f3764967fd7cb25972cfb2b3a09 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 26 Sep 2024 15:09:57 +0800 Subject: [PATCH] fix: tolerate build error when watching for changes Signed-off-by: Frost Ming --- src/bentoml/_internal/cloud/deployment.py | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/bentoml/_internal/cloud/deployment.py b/src/bentoml/_internal/cloud/deployment.py index de9dd12ed26..f14837dc953 100644 --- a/src/bentoml/_internal/cloud/deployment.py +++ b/src/bentoml/_internal/cloud/deployment.py @@ -869,18 +869,24 @@ def is_bento_changed(bento_info: Bento) -> bool: if not is_editable or any( fs.path.isparent(bento_dir, p) for _, p in changes ): - bento_info = ensure_bento( - bento_dir, - bare=True, - push=False, - reload=True, - _client=self._client, - ) - assert isinstance(bento_info, Bento) - if is_bento_changed(bento_info): - # stop log tail and reset the deployment - needs_update = True - break + try: + bento_info = ensure_bento( + bento_dir, + bare=True, + push=False, + reload=True, + _client=self._client, + ) + except Exception as e: + spinner.console.print( + f"🚨 [bold red]Failed to build Bento: {e}[/]" + ) + else: + assert isinstance(bento_info, Bento) + if is_bento_changed(bento_info): + # stop log tail and reset the deployment + needs_update = True + break build_config = get_bento_build_config(bento_dir) upload_files: list[tuple[str, bytes]] = []