From 38f5bc10d52b18926c6c69ea8433bccf5a9acf3e Mon Sep 17 00:00:00 2001 From: kthui <18255193+kthui@users.noreply.github.com> Date: Fri, 28 Apr 2023 17:17:13 -0700 Subject: [PATCH 1/3] Check TRT err msg more granularly --- .../trt_error_propagation_test.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/qa/L0_trt_error_propagation/trt_error_propagation_test.py b/qa/L0_trt_error_propagation/trt_error_propagation_test.py index 43a3b1cf78..784594d98a 100644 --- a/qa/L0_trt_error_propagation/trt_error_propagation_test.py +++ b/qa/L0_trt_error_propagation/trt_error_propagation_test.py @@ -40,12 +40,23 @@ def test_invalid_trt_model(self): with self.assertRaises(InferenceServerException) as cm: self.__triton.load_model("invalid_plan_file") err_msg = str(cm.exception) - self.assertIn("Internal: unable to create TensorRT engine", err_msg, - "Caught an unexpected exception") + # "[err_msg]" -> "[triton_err_msg]: [backend_err_msg]: [trt_err_msg]" + backend_err_msg = "Internal: unable to create TensorRT engine: " self.assertIn( - "Error Code 4: Internal Error (Engine deserialization failed.)", - err_msg, - "Detailed error message not propagated back to triton client") + backend_err_msg, err_msg, + "Cannot find the expected error message from TensorRT backend") + triton_err_msg, trt_err_msg = err_msg.split(backend_err_msg) + for triton_err_msg_part in [ + "load failed for model", "version 1 is at UNAVAILABLE state: " + ]: + self.assertIn( + triton_err_msg_part, triton_err_msg, + "Cannot find an expected part of error message from Triton") + for trt_err_msg_part in ["Error Code ", "Internal Error "]: + self.assertIn( + trt_err_msg_part, trt_err_msg, + "Cannot find an expected part of error message from TensorRT framework" + ) def test_invalid_trt_model_autocomplete(self): with self.assertRaises(InferenceServerException) as cm: From f4cbf55bb578b2529c7460aedae0c8cc2d1d414d Mon Sep 17 00:00:00 2001 From: kthui <18255193+kthui@users.noreply.github.com> Date: Fri, 28 Apr 2023 18:24:03 -0700 Subject: [PATCH 2/3] Clarify source of error messages --- .../trt_error_propagation_test.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/qa/L0_trt_error_propagation/trt_error_propagation_test.py b/qa/L0_trt_error_propagation/trt_error_propagation_test.py index 784594d98a..9d14373647 100644 --- a/qa/L0_trt_error_propagation/trt_error_propagation_test.py +++ b/qa/L0_trt_error_propagation/trt_error_propagation_test.py @@ -39,22 +39,23 @@ def setUp(self): def test_invalid_trt_model(self): with self.assertRaises(InferenceServerException) as cm: self.__triton.load_model("invalid_plan_file") - err_msg = str(cm.exception) + got_err_msg = str(cm.exception) # "[err_msg]" -> "[triton_err_msg]: [backend_err_msg]: [trt_err_msg]" - backend_err_msg = "Internal: unable to create TensorRT engine: " + expected_backend_err_msg = "Internal: unable to create TensorRT engine: " self.assertIn( - backend_err_msg, err_msg, + expected_backend_err_msg, got_err_msg, "Cannot find the expected error message from TensorRT backend") - triton_err_msg, trt_err_msg = err_msg.split(backend_err_msg) - for triton_err_msg_part in [ + got_triton_err_msg, got_trt_err_msg = got_err_msg.split( + expected_backend_err_msg) + for expected_triton_err_msg_part in [ "load failed for model", "version 1 is at UNAVAILABLE state: " ]: self.assertIn( - triton_err_msg_part, triton_err_msg, + expected_triton_err_msg_part, got_triton_err_msg, "Cannot find an expected part of error message from Triton") - for trt_err_msg_part in ["Error Code ", "Internal Error "]: + for expected_trt_err_msg_part in ["Error Code ", "Internal Error "]: self.assertIn( - trt_err_msg_part, trt_err_msg, + expected_trt_err_msg_part, got_trt_err_msg, "Cannot find an expected part of error message from TensorRT framework" ) From 999ed802225aad9e0f44e2d1317c37d107facbe5 Mon Sep 17 00:00:00 2001 From: kthui <18255193+kthui@users.noreply.github.com> Date: Mon, 1 May 2023 12:20:15 -0700 Subject: [PATCH 3/3] Consolidate tests for message parts --- .../trt_error_propagation_test.py | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/qa/L0_trt_error_propagation/trt_error_propagation_test.py b/qa/L0_trt_error_propagation/trt_error_propagation_test.py index 9d14373647..300f8b9705 100644 --- a/qa/L0_trt_error_propagation/trt_error_propagation_test.py +++ b/qa/L0_trt_error_propagation/trt_error_propagation_test.py @@ -39,25 +39,18 @@ def setUp(self): def test_invalid_trt_model(self): with self.assertRaises(InferenceServerException) as cm: self.__triton.load_model("invalid_plan_file") - got_err_msg = str(cm.exception) - # "[err_msg]" -> "[triton_err_msg]: [backend_err_msg]: [trt_err_msg]" - expected_backend_err_msg = "Internal: unable to create TensorRT engine: " - self.assertIn( - expected_backend_err_msg, got_err_msg, - "Cannot find the expected error message from TensorRT backend") - got_triton_err_msg, got_trt_err_msg = got_err_msg.split( - expected_backend_err_msg) - for expected_triton_err_msg_part in [ - "load failed for model", "version 1 is at UNAVAILABLE state: " - ]: - self.assertIn( - expected_triton_err_msg_part, got_triton_err_msg, - "Cannot find an expected part of error message from Triton") - for expected_trt_err_msg_part in ["Error Code ", "Internal Error "]: + err_msg = str(cm.exception) + # All 'expected_msg_parts' should be present in the 'err_msg' in order + expected_msg_parts = [ + "load failed for model", "version 1 is at UNAVAILABLE state: ", + "Internal: unable to create TensorRT engine: ", "Error Code ", + "Internal Error " + ] + for expected_msg_part in expected_msg_parts: self.assertIn( - expected_trt_err_msg_part, got_trt_err_msg, - "Cannot find an expected part of error message from TensorRT framework" - ) + expected_msg_part, err_msg, + "Cannot find an expected part of error message") + _, err_msg = err_msg.split(expected_msg_part) def test_invalid_trt_model_autocomplete(self): with self.assertRaises(InferenceServerException) as cm: