Skip to content

Commit aca8812

Browse files
committed
Test response_sender.send() after closed
1 parent ce3142d commit aca8812

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

qa/python_models/execute_cancel/model.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,26 @@ def response_thread(execute_processed_requests, processed_requests):
102102
flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL
103103
)
104104
else:
105+
# test response_sender.send() after it is closed upon checking for
106+
# confirmed request cancelled
105107
dummy_tensor = pb_utils.Tensor(
106108
"DUMMY_OUT", np.array([[1]], np.single)
107109
)
108110
dummy_response = pb_utils.InferenceResponse([dummy_tensor])
109-
response_sender.send(dummy_response)
111+
raised_exception = False
112+
try:
113+
response_sender.send(dummy_response)
114+
except pb_utils.TritonModelException as e:
115+
if (
116+
"Unable to send response. Response sender has been closed."
117+
not in str(e)
118+
):
119+
raise e
120+
raised_exception = True
121+
if not raised_exception:
122+
raise pb_utils.TritonModelException(
123+
"response_sender did not raise an exception on send after closed"
124+
)
110125

111126
thread = threading.Thread(
112127
target=response_thread,

0 commit comments

Comments
 (0)