@@ -31,11 +31,12 @@ CLIENT_LOG_BASE="./client"
31
31
INFER_TEST=infer_test.py
32
32
33
33
# Google cloud variables (Point to bucket when testing GCS)
34
- # NOTES:
35
- # - This folder MUST exist otherwise the GCS test will fail
36
- # - If this variable doesn't end in a slash gsutil-m cp becomes slow
37
34
38
- DATA_URL=" gs://path/to/gcs/bucket/models/"
35
+ BUCKET_URL=" gs://bucket"
36
+
37
+ # Remove Slash in BUCKET_URL
38
+ BUCKET_URL=${BUCKET_URL%/ }
39
+ BUCKET_URL_SLASH=" ${BUCKET_URL} /"
39
40
40
41
SERVER=/opt/tensorrtserver/bin/trtserver
41
42
SERVER_TIMEOUT=360
@@ -50,71 +51,126 @@ rm -f $SERVER_LOG_BASE* $CLIENT_LOG_BASE*
50
51
51
52
RET=0
52
53
53
- SERVER_ARGS=" --model-store=$DATA_URL --exit-timeout-secs=120"
54
-
55
54
# Construct model repository
56
55
57
56
KIND=" KIND_GPU"
58
57
59
- # copy models in model directory
60
- rm -rf models && mkdir -p models
61
- for FW in graphdef savedmodel netdef onnx libtorch plan; do
62
- cp -r /data/inferenceserver/qa_model_repository/${FW} _float32_float32_float32/ models/
63
- done
58
+ for MAYBE_SLASH in " " " /" ; do
59
+
60
+ ROOT_REPO=" $BUCKET_URL$MAYBE_SLASH "
61
+ MODEL_REPO=" ${BUCKET_URL_SLASH} models${MAYBE_SLASH} "
62
+
63
+ # copy models in model directory
64
+ rm -rf models && mkdir -p models
65
+
66
+ # perform empty repo tests
67
+
68
+ SERVER_ARGS=" --model-store=$ROOT_REPO --exit-timeout-secs=120"
69
+
70
+ run_server
71
+ if [ " $SERVER_PID " == " 0" ]; then
72
+ echo -e " \n***\n*** Failed to start $SERVER \n***"
73
+ cat $SERVER_LOG
74
+ exit 1
75
+ fi
76
+
77
+ kill $SERVER_PID
78
+ wait $SERVER_PID
64
79
65
- # Copy models with string inputs and remove nobatch (bs=1) models
66
- cp -r /data/inferenceserver/qa_model_repository/ * _object_object_object/ models/
67
- rm -rf models/* nobatch *
80
+ # run with a non-root empty model repo
81
+ touch models/dummy
82
+ gsutil cp -r models/ " $BUCKET_URL_SLASH "
68
83
69
- for FW in graphdef savedmodel netdef onnx libtorch plan; do
70
- for MC in ` ls models/${FW} * /config.pbtxt` ; do
71
- echo " instance_group [ { kind: ${KIND} }]" >> $MC
84
+ SERVER_ARGS=" --model-store=$MODEL_REPO --exit-timeout-secs=120"
85
+
86
+ run_server
87
+ if [ " $SERVER_PID " == " 0" ]; then
88
+ echo -e " \n***\n*** Failed to start $SERVER \n***"
89
+ cat $SERVER_LOG
90
+ exit 1
91
+ fi
92
+
93
+ kill $SERVER_PID
94
+ wait $SERVER_PID
95
+
96
+ gsutil -m rm " ${BUCKET_URL_SLASH} **"
97
+ rm models/dummy
98
+
99
+ # Now start model tests
100
+
101
+ for FW in graphdef savedmodel netdef onnx libtorch plan; do
102
+ cp -r /data/inferenceserver/qa_model_repository/${FW} _float32_float32_float32/ models/
72
103
done
73
- done
74
104
75
- # now traverse the tree and create empty version directories that gsutil skips
76
- for dir in ` ls models/` ; do
77
- for subdir in ` ls models/$dir ` ; do
78
- if [ -d models/$dir /$subdir ] && [ -z " $( ls models/$dir /$subdir ) " ]; then
79
- touch models/$dir /$subdir /$subdir
80
- fi
105
+ # Copy models with string inputs and remove nobatch (bs=1) models
106
+ cp -r /data/inferenceserver/qa_model_repository/* _object_object_object/ models/
107
+ rm -rf models/* nobatch*
108
+
109
+ for FW in graphdef savedmodel netdef onnx libtorch plan; do
110
+ for MC in ` ls models/${FW} * /config.pbtxt` ; do
111
+ echo " instance_group [ { kind: ${KIND} }]" >> $MC
112
+ done
81
113
done
82
- done
83
114
84
- # copy contents of /models into GCS bucket.
85
- gsutil -m rm $DATA_URL ** && \
86
- gsutil -m cp -r models/** $DATA_URL
115
+ # now traverse the tree and create empty version directories that gsutil skips
116
+ for dir in ` ls models/` ; do
117
+ for subdir in ` ls models/$dir ` ; do
118
+ if [ -d models/$dir /$subdir ] && [ -z " $( ls models/$dir /$subdir ) " ]; then
119
+ touch models/$dir /$subdir /$subdir
120
+ fi
121
+ done
122
+ done
87
123
88
- run_server
89
- if [ " $SERVER_PID " == " 0" ]; then
90
- echo -e " \n***\n*** Failed to start $SERVER \n***"
91
- cat $SERVER_LOG
92
- exit 1
93
- fi
124
+ # Perform test with model repository variants
125
+ for repo in " models/**" " models" ; do
94
126
95
- set +e
127
+ # copy contents of /models into GCS bucket.
128
+ gsutil -m cp -r $repo $BUCKET_URL_SLASH
96
129
97
- # python unittest seems to swallow ImportError and still return 0
98
- # exit code. So need to explicitly check CLIENT_LOG to make sure
99
- # we see some running tests
100
- python $INFER_TEST > $CLIENT_LOG 2>&1
101
- if [ $? -ne 0 ]; then
102
- cat $CLIENT_LOG
103
- echo -e " \n***\n*** Test Failed\n***"
104
- RET=1
105
- fi
130
+ if [ " $repo " == " models" ]; then
131
+ # set server arguments
132
+ SERVER_ARGS=" --model-store=$MODEL_REPO --exit-timeout-secs=120"
133
+ else
134
+ # set server arguments
135
+ SERVER_ARGS=" --model-store=$ROOT_REPO --exit-timeout-secs=120"
136
+ fi
106
137
107
- grep -c " HTTP/1.1 200 OK" $CLIENT_LOG
108
- if [ $? -ne 0 ]; then
109
- cat $CLIENT_LOG
110
- echo -e " \n***\n*** Test Failed To Run\n***"
111
- RET=1
112
- fi
138
+ run_server
139
+ if [ " $SERVER_PID " == " 0" ]; then
140
+ echo -e " \n***\n*** Failed to start $SERVER \n***"
141
+ cat $SERVER_LOG
142
+ exit 1
143
+ fi
144
+
145
+ set +e
113
146
114
- set -e
147
+ # python unittest seems to swallow ImportError and still return 0
148
+ # exit code. So need to explicitly check CLIENT_LOG to make sure
149
+ # we see some running tests
150
+ python $INFER_TEST > $CLIENT_LOG 2>&1
151
+ if [ $? -ne 0 ]; then
152
+ cat $CLIENT_LOG
153
+ echo -e " \n***\n*** Test Failed\n***"
154
+ RET=1
155
+ fi
156
+
157
+ grep -c " HTTP/1.1 200 OK" $CLIENT_LOG
158
+ if [ $? -ne 0 ]; then
159
+ cat $CLIENT_LOG
160
+ echo -e " \n***\n*** Test Failed To Run\n***"
161
+ RET=1
162
+ fi
163
+
164
+ set -e
115
165
116
- kill $SERVER_PID
117
- wait $SERVER_PID
166
+ kill $SERVER_PID
167
+ wait $SERVER_PID
168
+
169
+ # Clean up bucket
170
+ gsutil -m rm " ${BUCKET_URL_SLASH} **"
171
+
172
+ done
173
+ done
118
174
119
175
if [ $RET -eq 0 ]; then
120
176
echo -e " \n***\n*** Test Passed\n***"
0 commit comments