Skip to content

Commit

Permalink
Add test for gRPC decoupled infer complete flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Apr 15, 2024
1 parent 3d27805 commit e36fec2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions qa/L0_grpc_state_cleanup/cleanup_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,15 @@ def test_decoupled_infer_with_params_shutdownserver(self):
infer_helper_map=[False, True],
)

def test_decoupled_infer_complete(self):
# Test if the Process() thread could release the state object before
# the StreamInferResponseComplete() thread is done accessing it.
self._decoupled_infer(request_count=1, repeat_count=1, stream_timeout=16)
# Check no error is printed to the log.
with open(os.environ["SERVER_LOG"]) as f:
server_log = f.read()
self.assertNotIn("Should not print this", server_log)


if __name__ == "__main__":
CleanUpTest.SERVER_PID = os.environ.get("SERVER_PID", CleanUpTest.SERVER_PID)
Expand Down
34 changes: 34 additions & 0 deletions qa/L0_grpc_state_cleanup/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,40 @@ for i in test_simple_infer_shutdownserver \
set -e
done

TEST_NAME=test_decoupled_infer_complete
export TRITONSERVER_DELAY_GRPC_COMPLETE=2000

SERVER_LOG="./inference_server.$TEST_NAME.log"
SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=2"
run_server
if [ "$SERVER_PID" == "0" ]; then
echo -e "\n***\n*** Failed to start $SERVER\n***"
cat $SERVER_LOG
exit 1
fi

echo "Test: $TEST_NAME" >>$CLIENT_LOG

set +e

SERVER_LOG=$SERVER_LOG python $CLEANUP_TEST CleanUpTest.$TEST_NAME >>$CLIENT_LOG 2>&1
if [ $? -ne 0 ]; then
cat $CLIENT_LOG
echo -e "\n***\n*** Test $TEST_NAME Failed\n***"
RET=1
fi

kill $SERVER_PID
wait $SERVER_PID

check_state_release $SERVER_LOG
if [ $? -ne 0 ]; then
cat $SERVER_LOG
echo -e "\n***\n*** State Verification Failed for $TEST_NAME\n***"
RET=1
fi

set -e

if [ $RET -eq 0 ]; then
echo -e "\n***\n*** Test Passed\n***"
Expand Down

0 comments on commit e36fec2

Please sign in to comment.