Skip to content

Commit 5a97991

Browse files
authored
ci: Improve error handling for Python backend model initialization failures (#8303)
1 parent e672c28 commit 5a97991

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

qa/L0_backend_python/test.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,65 @@ and shared memory pages after starting triton equals to $current_num_pages \n***
407407
exit 1
408408
fi
409409

410+
411+
# Test model with non-existent model file
412+
# The model.py file is intentionally not created to trigger the failure.
413+
rm -fr ./models
414+
mkdir -p models/non_existent_model/1
415+
cp ../python_models/identity_fp32/config.pbtxt ./models/non_existent_model/config.pbtxt
416+
(cd models/non_existent_model && \
417+
sed -i "s/^name:.*/name: \"non_existent_model\"/" config.pbtxt)
418+
419+
ERROR_MESSAGE_1="Failed to preinitialize Python stub: Python model file not found in '`pwd`/models/non_existent_model/1/model.py'"
420+
ERROR_MESSAGE_2="failed to load 'non_existent_model'"
421+
422+
for test_mode in "default" "auto_config_disabled"; do
423+
if [ "$test_mode" == "default" ]; then
424+
SERVER_LOG_SUFFIX=""
425+
SERVER_ARGS=$BASE_SERVER_ARGS
426+
else
427+
SERVER_LOG_SUFFIX="_auto_config_disabled"
428+
SERVER_ARGS="$BASE_SERVER_ARGS --disable-auto-complete-config"
429+
fi
430+
431+
SERVER_LOG="./non_existent_model_server${SERVER_LOG_SUFFIX}.log"
432+
CLIENT_LOG="./non_existent_model_client${SERVER_LOG_SUFFIX}.log"
433+
434+
prev_num_pages=`get_shm_pages`
435+
run_server
436+
if [ "$SERVER_PID" != "0" ]; then
437+
echo -e "*** FAILED: unexpected success starting $SERVER" >> $CLIENT_LOG
438+
RET=1
439+
kill_server
440+
else
441+
if grep -q "$ERROR_MESSAGE_1" $SERVER_LOG; then
442+
echo -e "Found \"$ERROR_MESSAGE_1\"" >> $CLIENT_LOG
443+
else
444+
echo -e "Not found \"$ERROR_MESSAGE_1\" in $SERVER_LOG" >> $CLIENT_LOG
445+
cat $SERVER_LOG >> $CLIENT_LOG
446+
RET=1
447+
fi
448+
449+
if grep -q "$ERROR_MESSAGE_2" $SERVER_LOG; then
450+
echo -e "Found \"$ERROR_MESSAGE_2\"" >> $CLIENT_LOG
451+
else
452+
echo -e "Not found \"$ERROR_MESSAGE_2\" in $SERVER_LOG" >> $CLIENT_LOG
453+
cat $SERVER_LOG >> $CLIENT_LOG
454+
RET=1
455+
fi
456+
fi
457+
458+
current_num_pages=`get_shm_pages`
459+
if [ $current_num_pages -ne $prev_num_pages ]; then
460+
cat $SERVER_LOG
461+
ls /dev/shm
462+
echo -e "\n***\n*** Test Failed. Shared memory pages were not cleaned properly.
463+
Shared memory pages before starting triton equals to $prev_num_pages
464+
and shared memory pages after starting triton equals to $current_num_pages \n***"
465+
exit 1
466+
fi
467+
done
468+
410469
# Disable env test for Jetson since cloud storage repos are not supported
411470
# Disable ensemble, io and bls tests for Jetson since GPU Tensors are not supported
412471
# Disable variants test for Jetson since already built without GPU Tensor support

0 commit comments

Comments
 (0)