@@ -53,9 +53,7 @@ def callback(user_data, result, error):
5353
5454
5555def prepare_infer_args (input_value ):
56- """
57- Create InferInput/InferRequestedOutput lists
58- """
56+ """Create InferInput and InferRequestedOutput lists for decoupled inference."""
5957 input_data = np .array ([[input_value ]], dtype = np .int32 )
6058 infer_input = [grpcclient .InferInput ("IN" , input_data .shape , "INT32" )]
6159 infer_input [0 ].set_data_from_numpy (input_data )
@@ -65,7 +63,7 @@ def prepare_infer_args(input_value):
6563
6664def collect_responses (user_data , expected_responses_count ):
6765 """
68- Collect responses from user_data until the final response flag is seen .
66+ Collect up to `expected_responses_count` responses from user_data .
6967 """
7068 errors = []
7169 responses = []
@@ -88,7 +86,7 @@ def collect_responses(user_data, expected_responses_count):
8886
8987
9088def call_inference_identity_model (model_name , protocol , client ):
91- """Helper to test inference functionality """
89+ """Send an inference request and verify the output matches the input. """
9290 shape = (1 , 8 )
9391 input_data = np .ones (shape , dtype = np .float32 )
9492
@@ -167,9 +165,7 @@ def setUp(self):
167165 self .client_grpc = grpcclient .InferenceServerClient (url = URL_GRPC )
168166
169167 def _run_inference_decoupled (self , index , model_name , expected_responses_count ):
170- """
171- Helper function for streaming inference.
172- """
168+ """Send a decoupled streaming inference request and verify responses."""
173169 user_data = UserData ()
174170 with grpcclient .InferenceServerClient (URL_GRPC ) as triton_client :
175171 try :
@@ -284,8 +280,7 @@ def test_is_model_ready_returns_true(self):
284280 f"iteration { i } - GRPC client - Model { model_name } should be READY" ,
285281 )
286282
287- # Inference should work normally
288- # readiness check functionality should not affect inference
283+ # Verify inference is unaffected by readiness checks.
289284 call_inference_identity_model (model_name , "http" , self .client_http )
290285 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
291286
@@ -304,8 +299,7 @@ def test_is_model_ready_returns_false(self):
304299 f"iteration { i } - GRPC client - Model { model_name } should be NOT READY" ,
305300 )
306301
307- # Inference should work normally
308- # readiness check functionality should not affect inference
302+ # Verify inference is unaffected by readiness checks.
309303 call_inference_identity_model (model_name , "http" , self .client_http )
310304 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
311305
@@ -324,12 +318,11 @@ def test_is_model_ready_raises_exception(self):
324318 f"iteration { i } - GRPC client - Model { model_name } should be NOT READY (exception)" ,
325319 )
326320
327- # Inference should work normally
328- # readiness check functionality should not affect inference
321+ # Verify inference is unaffected by readiness checks.
329322 call_inference_identity_model (model_name , "http" , self .client_http )
330323 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
331324
332- # Test good model afterwards to ensure server is healthy
325+ # Verify a healthy model is still ready to confirm server stability.
333326 model_name = "is_model_ready_fn_returns_true"
334327 for i in range (num_requests ):
335328 self .assertTrue (
@@ -341,8 +334,7 @@ def test_is_model_ready_raises_exception(self):
341334 f"iteration { i } - GRPC client - Model { model_name } should be READY" ,
342335 )
343336
344- # Inference should work normally
345- # readiness check functionality should not affect inference
337+ # Verify inference is unaffected by readiness checks.
346338 call_inference_identity_model (model_name , "http" , self .client_http )
347339 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
348340
@@ -361,12 +353,11 @@ def test_is_model_ready_returns_non_boolean(self):
361353 f"iteration { i } - GRPC client - Model { model_name } should be NOT READY (wrong return type)" ,
362354 )
363355
364- # Inference should work normally
365- # readiness check functionality should not affect inference
356+ # Verify inference is unaffected by readiness checks.
366357 call_inference_identity_model (model_name , "http" , self .client_http )
367358 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
368359
369- # Test good model afterwards to ensure server is healthy
360+ # Verify a healthy model is still ready to confirm server stability.
370361 model_name = "is_model_ready_fn_returns_true"
371362 for i in range (num_requests ):
372363 self .assertTrue (
@@ -378,8 +369,7 @@ def test_is_model_ready_returns_non_boolean(self):
378369 f"iteration { i } - GRPC client - Model { model_name } should be READY" ,
379370 )
380371
381- # Inference should work normally
382- # readiness check functionality should not affect inference
372+ # Verify inference is unaffected by readiness checks.
383373 call_inference_identity_model (model_name , "http" , self .client_http )
384374 call_inference_identity_model (model_name , "grpc" , self .client_grpc )
385375
@@ -450,7 +440,7 @@ def do_inference(protocol, index):
450440 except Exception as e :
451441 infer_errors [protocol ].append ((index , str (e )))
452442
453- # Launch concurrent ready checks
443+ # Launch concurrent readiness and inference requests.
454444 http_threads = []
455445 for i in range (num_requests ):
456446 t1 = threading .Thread (target = check_model_readiness , args = ("http" , i ))
@@ -466,8 +456,6 @@ def do_inference(protocol, index):
466456 for t in http_threads :
467457 self .assertFalse (t .is_alive (), f"HTTP threads are not completed" )
468458
469- time .sleep (5 )
470-
471459 grpc_threads = []
472460 for i in range (num_requests ):
473461 t1 = threading .Thread (target = check_model_readiness , args = ("grpc" , i ))
@@ -483,8 +471,6 @@ def do_inference(protocol, index):
483471 for t in grpc_threads :
484472 self .assertFalse (t .is_alive (), f"gRPC threads are not completed" )
485473
486- time .sleep (5 )
487-
488474 # Verify no errors in readiness checks
489475 self .assertEqual (
490476 len (ready_errors ["http" ]), 0 , f"HTTP errors: { ready_errors ['http' ]} "
0 commit comments