Skip to content

Commit

Permalink
chore: catch exceptions on all async_run
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
  • Loading branch information
aarnphm committed Sep 1, 2023
1 parent 1ca5801 commit 257186f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/bentoml/_internal/server/runner_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,13 @@ async def infer_batch(
params_list, input_batch_dim
)

batch_ret = await runner_method.async_run(
*batched_params.args, **batched_params.kwargs
)
try:
batch_ret = await runner_method.async_run(
*batched_params.args, **batched_params.kwargs
)
except Exception:
traceback.print_exc()
raise

# multiple output branch
if LazyType["tuple[t.Any, ...]"](tuple).isinstance(batch_ret):
Expand Down Expand Up @@ -273,7 +277,13 @@ async def infer_single(paramss: t.Sequence[Params[t.Any]]):

params = paramss[0].map(AutoContainer.from_payload)

ret = await runner_method.async_run(*params.args, **params.kwargs)
try:
ret = await runner_method.async_run(
*params.args, **params.kwargs
)
except Exception:
traceback.print_exc()
raise

payload = AutoContainer.to_payload(ret, 0)
return (payload,)
Expand Down

0 comments on commit 257186f

Please sign in to comment.