From 2932bb0e1a247c07f2c933d19542ddf2e5a4e5fe Mon Sep 17 00:00:00 2001 From: Nathan Mellis Date: Fri, 17 Nov 2023 08:59:55 -0800 Subject: [PATCH] Print traceback on model prediction exception. --- packages/chassisml/src/chassis/runtime/model_runner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/chassisml/src/chassis/runtime/model_runner.py b/packages/chassisml/src/chassis/runtime/model_runner.py index b9b0c5fc..2a9ead94 100644 --- a/packages/chassisml/src/chassis/runtime/model_runner.py +++ b/packages/chassisml/src/chassis/runtime/model_runner.py @@ -2,6 +2,8 @@ import os import json +import traceback + import cloudpickle from typing import List, Mapping, Optional, Sequence, cast @@ -106,6 +108,7 @@ def _predict_single(self, inputs: Sequence[Mapping[str, bytes]]) -> Sequence[Map output: Mapping[str, bytes] = predict_fn(input_item) except Exception as e: print(f"Error: {e}") + traceback.print_exc() # TODO - is there more information we can include here like a backtrace? # TODO - convert the error to bytes output = {"error": f"{e}".encode()}