Skip to content

Commit

Permalink
fix: show warning instead of hard failure when model is missing (#4693)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed May 6, 2024
1 parent e2c21b8 commit 6de2041
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bentoml/_internal/bento/bento.py
Expand Up @@ -420,7 +420,15 @@ def total_size(
continue
except NotFound:
pass
global_model = model_store.get(model.tag)
try:
global_model = model_store.get(model.tag)
except NotFound:
logger.warning(
"Bento: %s: Missing model %s",
self.tag,
model.tag,
)
continue
total_size += global_model.file_size
return total_size

Expand Down
7 changes: 7 additions & 0 deletions src/bentoml/_internal/log.py
Expand Up @@ -23,15 +23,22 @@ def filter(self, record: logging.LogRecord) -> bool:
"version": 1,
"disable_existing_loggers": True,
"filters": {"infofilter": {"()": InfoFilter}},
"formatters": {
"simple": {
"format": "%(levelname)s: %(message)s",
}
},
"handlers": {
"bentomlhandler": {
"class": "logging.StreamHandler",
"filters": ["infofilter"],
"stream": "ext://sys.stdout",
"formatter": "simple",
},
"defaulthandler": {
"class": "logging.StreamHandler",
"level": logging.WARNING,
"formatter": "simple",
},
},
"loggers": {
Expand Down

0 comments on commit 6de2041

Please sign in to comment.