Skip to content

Test full error returned when custom batcher init fails #5729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions qa/L0_batch_custom/batch_custom_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,21 @@ def check_response(self,

def check_status(self, model_name, batch_exec, request_cnt, infer_cnt,
exec_count):
stats = self.triton_client_.get_inference_statistics(model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
# There is a time window between when responses are returned and statistics are updated.
# To prevent intermittent test failure during that window, wait up to 10 seconds for the
# inference statistics to be ready.
num_tries = 10
for i in range(num_tries):
stats = self.triton_client_.get_inference_statistics(
model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
actual_exec_cnt = stats.model_stats[0].execution_count
if actual_exec_cnt == exec_count:
break
print("WARNING: expect {} executions, got {} (attempt {})".format(
exec_count, actual_exec_cnt, i))
time.sleep(1)

self.assertEqual(stats.model_stats[0].name, model_name,
"expect model stats for model {}".format(model_name))
self.assertEqual(
Expand Down
35 changes: 33 additions & 2 deletions qa/L0_batch_custom/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ cp -r backend/examples/batching_strategies/single_batching/build/libtriton_singl
# Run a test to validate the single batching strategy example.
# Then, run tests to validate the volume batching example being passed in via the backend dir, model dir, version dir, and model config.
BACKEND_DIR="/opt/tritonserver/backends/onnxruntime"
MODEL_DIR="models/$MODEL_NAME/"
MODEL_DIR="models/$MODEL_NAME"
VERSION_DIR="$MODEL_DIR/1/"

test_types=('single_batching_backend' 'backend_directory' 'model_directory' 'version_directory' 'model_config')
Expand Down Expand Up @@ -151,10 +151,41 @@ for i in "${!test_setups[@]}"; do
wait $SERVER_PID
done

# Test ModelBatchInitialize failure
FILE_PATH="backend/examples/batching_strategies/volume_batching/src/volume_batching.cc"
OLD_STRING="\/\/ Batcher will point to an unsigned integer representing the maximum"
NEW_STRING="return TRITONSERVER_ErrorNew(TRITONSERVER_ERROR_NOT_FOUND,\"Failure test case\");"

sed -i "s/${OLD_STRING}/${NEW_STRING}/g" ${FILE_PATH}

(cd backend/examples/batching_strategies/volume_batching &&
cd build &&
cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install \
-DTRITON_CORE_REPO_TAG=$TRITON_CORE_REPO_TAG .. &&
make -j4 install)

cp -r backend/examples/batching_strategies/volume_batching/build/libtriton_volumebatching.so models/${MODEL_NAME}/libtriton_volumebatching.so

SERVER_LOG=${SERVER_LOG_BASE}_batching_init_failure

run_server
if [ "$SERVER_PID" != "0" ]; then
cat $SERVER_LOG
echo -e "\n***\n*** ModelBatchInit Error Test: unexpected successful server start $SERVER\n***"
kill_server
RET=1
else
if [ `grep -c "Failure test case" $SERVER_LOG` -lt 1 ] || [ `grep -c "Not found" $SERVER_LOG` -lt 1 ]; then
cat $SERVER_LOG
echo -e "\n***\n*** ModelBatchInit Error Test: failed to find \"Failure test case\" message and/or \"Not found\" error type"
RET=1
fi
fi


if [ $RET -eq 0 ]; then
echo -e "\n***\n*** Test Passed\n***"
else
cat $CLIENT_LOG
echo -e "\n***\n*** Test FAILED\n***"
fi

Expand Down
17 changes: 15 additions & 2 deletions qa/L0_optional_input/optional_input_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,21 @@ def check_response(self, thresholds, provided_inputs=("INPUT0", "INPUT1")):
self.add_deferred_exception(ex)

def check_status(self, model_name, batch_exec, request_cnt, infer_cnt):
stats = self.triton_client_.get_inference_statistics(model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
# There is a time window between when responses are returned and statistics are updated.
# To prevent intermittent test failure during that window, wait up to 10 seconds for the
# inference statistics to be ready.
num_tries = 10
for i in range(num_tries):
stats = self.triton_client_.get_inference_statistics(
model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
actual_exec_cnt = stats.model_stats[0].execution_count
if actual_exec_cnt == exec_cnt:
break
print("WARNING: expect {} executions, got {} (attempt {})".format(
exec_cnt, actual_exec_cnt, i))
time.sleep(1)

self.assertEqual(stats.model_stats[0].name, model_name,
"expect model stats for model {}".format(model_name))
self.assertEqual(
Expand Down
17 changes: 15 additions & 2 deletions qa/L0_trt_shape_tensors/trt_shape_tensor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,21 @@ def check_setup(self, model_name):
_max_queue_delay_ms * 1000) # 10 secs

def check_status(self, model_name, batch_exec, exec_cnt, infer_cnt):
stats = self.triton_client_.get_inference_statistics(model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
# There is a time window between when responses are returned and statistics are updated.
# To prevent intermittent test failure during that window, wait up to 10 seconds for the
# inference statistics to be ready.
num_tries = 10
for i in range(num_tries):
stats = self.triton_client_.get_inference_statistics(
model_name, "1")
self.assertEqual(len(stats.model_stats), 1, "expect 1 model stats")
actual_exec_cnt = stats.model_stats[0].execution_count
if actual_exec_cnt == exec_cnt:
break
print("WARNING: expect {} executions, got {} (attempt {})".format(
exec_cnt, actual_exec_cnt, i))
time.sleep(1)

self.assertEqual(stats.model_stats[0].name, model_name,
"expect model stats for model {}".format(model_name))
self.assertEqual(
Expand Down