Skip to content

Commit c8f0378

Browse files
authored
ci: fix L0_lifecycle (#8116)
1 parent 88cffa2 commit c8f0378

File tree

2 files changed

+116
-101
lines changed

2 files changed

+116
-101
lines changed

qa/L0_lifecycle/lifecycle_test.py

Lines changed: 72 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def test_parse_error_modelfail(self):
205205

206206
# And other models should be loaded successfully
207207
try:
208-
for base_name in ["onnx"]:
208+
for base_name in ["openvino", "onnx"]:
209209
for triton_client in (
210210
httpclient.InferenceServerClient("localhost:8000", verbose=True),
211211
grpcclient.InferenceServerClient("localhost:8001", verbose=True),
@@ -268,7 +268,7 @@ def test_parse_error_modelfail_nostrict(self):
268268

269269
# And other models should be loaded successfully
270270
try:
271-
for base_name in ["onnx"]:
271+
for base_name in ["openvino", "onnx"]:
272272
for triton_client in (
273273
httpclient.InferenceServerClient("localhost:8000", verbose=True),
274274
grpcclient.InferenceServerClient("localhost:8001", verbose=True),
@@ -301,7 +301,7 @@ def test_parse_error_no_model_config(self):
301301
):
302302
try:
303303
model_name = tu.get_model_name(
304-
"libtorch", np.float32, np.float32, np.float32
304+
"openvino", np.float32, np.float32, np.float32
305305
)
306306

307307
# expecting ready because not strict readiness
@@ -318,13 +318,13 @@ def test_parse_error_no_model_config(self):
318318

319319
except Exception as ex:
320320
self.assertIn(
321-
"Request for unknown model: 'libtorch_float32_float32_float32' is not found",
321+
"Request for unknown model: 'openvino_float32_float32_float32' is not found",
322322
ex.message(),
323323
)
324324

325325
# And other models should be loaded successfully
326326
try:
327-
for base_name in ["onnx"]:
327+
for base_name in ["libtorch", "onnx"]:
328328
model_name = tu.get_model_name(
329329
base_name, np.float32, np.float32, np.float32
330330
)
@@ -365,7 +365,7 @@ def test_init_error_modelfail(self):
365365

366366
# And other models should be loaded successfully
367367
try:
368-
for base_name in ["onnx"]:
368+
for base_name in ["openvino", "libtorch", "onnx"]:
369369
model_name = tu.get_model_name(
370370
base_name, np.float32, np.float32, np.float32
371371
)
@@ -375,7 +375,7 @@ def test_init_error_modelfail(self):
375375

376376
try:
377377
tensor_shape = (1, 16)
378-
for base_name in ["onnx"]:
378+
for base_name in ["openvino", "libtorch", "onnx"]:
379379
iu.infer_exact(
380380
self,
381381
base_name,
@@ -403,15 +403,15 @@ def test_parse_error_model_no_version(self):
403403
self.assertFalse(triton_client.is_server_ready())
404404

405405
model_name = tu.get_model_name(
406-
"libtorch", np.float32, np.float32, np.float32
406+
"openvino", np.float32, np.float32, np.float32
407407
)
408408
self.assertFalse(triton_client.is_model_ready(model_name))
409409
except Exception as ex:
410410
self.assertTrue(False, "unexpected error {}".format(ex))
411411

412412
# Sanity check that other models are loaded properly
413413
try:
414-
for base_name in ["onnx"]:
414+
for base_name in ["libtorch", "onnx"]:
415415
model_name = tu.get_model_name(
416416
base_name, np.float32, np.float32, np.float32
417417
)
@@ -425,7 +425,7 @@ def test_parse_error_model_no_version(self):
425425
self.assertTrue(False, "unexpected error {}".format(ex))
426426

427427
try:
428-
for base_name in ["onnx"]:
428+
for base_name in ["libtorch", "onnx"]:
429429
iu.infer_exact(
430430
self,
431431
base_name,
@@ -453,12 +453,12 @@ def test_parse_error_model_no_version(self):
453453

454454
try:
455455
iu.infer_exact(
456-
self, "libtorch", tensor_shape, 1, np.float32, np.float32, np.float32
456+
self, "openvino", tensor_shape, 1, np.float32, np.float32, np.float32
457457
)
458458
self.assertTrue(False, "expected error for unavailable model " + model_name)
459459
except Exception as ex:
460460
self.assertIn(
461-
"Request for unknown model: 'libtorch_float32_float32_float32' has no available versions",
461+
"Request for unknown model: 'openvino_float32_float32_float32' has no available versions",
462462
ex.message(),
463463
)
464464

@@ -475,7 +475,7 @@ def test_parse_ignore_zero_prefixed_version(self):
475475
self.assertTrue(triton_client.is_server_ready())
476476

477477
model_name = tu.get_model_name(
478-
"onnx", np.float32, np.float32, np.float32
478+
"libtorch", np.float32, np.float32, np.float32
479479
)
480480
self.assertTrue(triton_client.is_model_ready(model_name, "1"))
481481
except Exception as ex:
@@ -485,7 +485,7 @@ def test_parse_ignore_zero_prefixed_version(self):
485485
# swap=False for version 1
486486
iu.infer_exact(
487487
self,
488-
"onnx",
488+
"libtorch",
489489
tensor_shape,
490490
1,
491491
np.float32,
@@ -509,7 +509,7 @@ def test_parse_ignore_non_intergral_version(self):
509509
self.assertTrue(triton_client.is_server_ready())
510510

511511
model_name = tu.get_model_name(
512-
"onnx", np.float32, np.float32, np.float32
512+
"libtorch", np.float32, np.float32, np.float32
513513
)
514514
self.assertTrue(triton_client.is_model_ready(model_name, "1"))
515515
except Exception as ex:
@@ -519,7 +519,7 @@ def test_parse_ignore_non_intergral_version(self):
519519
# swap=False for version 1
520520
iu.infer_exact(
521521
self,
522-
"onnx",
522+
"libtorch",
523523
tensor_shape,
524524
1,
525525
np.float32,
@@ -1043,13 +1043,13 @@ def test_dynamic_version_load_unload_disabled(self):
10431043
self.assertTrue(False, "unexpected error {}".format(ex))
10441044

10451045
def test_dynamic_model_modify(self):
1046-
models_base = "plan"
1046+
models_base = ("libtorch", "plan")
10471047
models_shape = ((1, 16), (1, 16))
10481048
models = list()
10491049
for m in models_base:
10501050
models.append(tu.get_model_name(m, np.float32, np.float32, np.float32))
10511051

1052-
# Make sure plan are in the status
1052+
# Make sure libtorch and plan are in the status
10531053
for model_name in models:
10541054
try:
10551055
for triton_client in (
@@ -1170,13 +1170,13 @@ def test_dynamic_model_modify(self):
11701170
self.assertTrue(False, "unexpected error {}".format(ex))
11711171

11721172
def test_dynamic_file_delete(self):
1173-
models_base = "plan"
1173+
models_base = ("onnx", "plan")
11741174
models_shape = ((1, 16), (1, 16))
11751175
models = list()
11761176
for m in models_base:
11771177
models.append(tu.get_model_name(m, np.float32, np.float32, np.float32))
11781178

1179-
# Make sure plan are in the status
1179+
# Make sure onnx and plan are in the status
11801180
for model_name in models:
11811181
try:
11821182
for triton_client in (
@@ -1266,22 +1266,24 @@ def test_dynamic_file_delete(self):
12661266

12671267
def test_multiple_model_repository_polling(self):
12681268
model_shape = (1, 16)
1269-
plan_name = tu.get_model_name("plan", np.float32, np.float32, np.float32)
1269+
libtorch_name = tu.get_model_name(
1270+
"libtorch", np.float32, np.float32, np.float32
1271+
)
12701272

12711273
# Models should be loaded successfully and infer
1272-
# successfully. Initially plan only has version 1.
1274+
# successfully. Initially libtorch only has version 1.
12731275
self._infer_success_models(
12741276
[
1275-
"plan",
1277+
"libtorch",
12761278
],
12771279
(1,),
12781280
model_shape,
12791281
)
1280-
self._infer_success_models(["libtorch", "onnx"], (1, 3), model_shape)
1282+
self._infer_success_models(["openvino", "onnx"], (1, 3), model_shape)
12811283

1282-
# Add the plan to the second model repository, should cause
1284+
# Add the libtorch to the second model repository, should cause
12831285
# it to be unloaded due to duplication
1284-
shutil.copytree(plan_name, "models_0/" + plan_name)
1286+
shutil.copytree(libtorch_name, "models_0/" + libtorch_name)
12851287
time.sleep(5) # wait for models to reload
12861288
try:
12871289
for triton_client in (
@@ -1290,27 +1292,31 @@ def test_multiple_model_repository_polling(self):
12901292
):
12911293
self.assertTrue(triton_client.is_server_live())
12921294
self.assertTrue(triton_client.is_server_ready())
1293-
self.assertFalse(triton_client.is_model_ready(plan_name, "1"))
1294-
self.assertFalse(triton_client.is_model_ready(plan_name, "3"))
1295+
self.assertFalse(triton_client.is_model_ready(libtorch_name, "1"))
1296+
self.assertFalse(triton_client.is_model_ready(libtorch_name, "3"))
12951297
except Exception as ex:
12961298
self.assertTrue(False, "unexpected error {}".format(ex))
12971299

1298-
self._infer_success_models(["libtorch", "onnx"], (1, 3), model_shape)
1300+
self._infer_success_models(["openvino", "onnx"], (1, 3), model_shape)
12991301

1300-
# Remove the plan from the first model repository, the
1302+
# Remove the libtorch from the first model repository, the
13011303
# model from the second model repository should be loaded
1302-
# properly. In the second model repository plan should
1304+
# properly. In the second model repository libtorch should
13031305
# have versions 1 and 3.
1304-
shutil.rmtree("models/" + plan_name)
1306+
shutil.rmtree("models/" + libtorch_name)
13051307
time.sleep(5) # wait for model to unload
1306-
self._infer_success_models(["plan", "libtorch", "onnx"], (1, 3), model_shape)
1308+
self._infer_success_models(
1309+
["libtorch", "openvino", "onnx"], (1, 3), model_shape
1310+
)
13071311

13081312
def test_multiple_model_repository_control(self):
13091313
# similar to test_multiple_model_repository_polling, but the
13101314
# model load/unload is controlled by the API
13111315
model_shape = (1, 16)
1312-
plan_name = tu.get_model_name("plan", np.float32, np.float32, np.float32)
1313-
model_bases = ["plan", "libtorch", "onnx"]
1316+
libtorch_name = tu.get_model_name(
1317+
"libtorch", np.float32, np.float32, np.float32
1318+
)
1319+
model_bases = ["libtorch", "openvino", "onnx"]
13141320

13151321
# Initially models are not loaded
13161322
for base in model_bases:
@@ -1339,38 +1345,38 @@ def test_multiple_model_repository_control(self):
13391345
self.assertTrue(False, "unexpected error {}".format(ex))
13401346

13411347
# Models should be loaded successfully and infer
1342-
# successfully. Initially plan only has version 1.
1348+
# successfully. Initially libtorch only has version 1.
13431349
self._infer_success_models(
13441350
[
1345-
"plan",
1351+
"libtorch",
13461352
],
13471353
(1,),
13481354
model_shape,
13491355
)
1350-
self._infer_success_models(["libtorch", "onnx"], (1, 3), model_shape)
1356+
self._infer_success_models(["openvino", "onnx"], (1, 3), model_shape)
13511357

1352-
# Add the plan to the second model repository. Because
1358+
# Add the libtorch to the second model repository. Because
13531359
# not polling this doesn't change any model state, all models
13541360
# are still loaded and available.
1355-
shutil.copytree(plan_name, "models_0/" + plan_name)
1361+
shutil.copytree(libtorch_name, "models_0/" + libtorch_name)
13561362
self._infer_success_models(
13571363
[
1358-
"plan",
1364+
"libtorch",
13591365
],
13601366
(1,),
13611367
model_shape,
13621368
)
1363-
self._infer_success_models(["libtorch", "onnx"], (1, 3), model_shape)
1369+
self._infer_success_models(["openvino", "onnx"], (1, 3), model_shape)
13641370

1365-
# Load plan again which should fail because it is now duplicated
1371+
# Load libtorch again which should fail because it is now duplicated
13661372
# in 2 model repositories. Use HTTP here.
13671373
try:
13681374
triton_client = httpclient.InferenceServerClient(
13691375
"localhost:8000", verbose=True
13701376
)
1371-
triton_client.load_model(plan_name)
1377+
triton_client.load_model(libtorch_name)
13721378
except Exception as ex:
1373-
self.assertIn("failed to load '{}'".format(plan_name), ex.message())
1379+
self.assertIn("failed to load '{}'".format(libtorch_name), ex.message())
13741380

13751381
try:
13761382
for triton_client in (
@@ -1381,32 +1387,34 @@ def test_multiple_model_repository_control(self):
13811387
self.assertTrue(triton_client.is_server_ready())
13821388
# Unlike polling mode, the failed load on the duplicate model
13831389
# should NOT unload the existing versions in model control mode.
1384-
self.assertTrue(triton_client.is_model_ready(plan_name, "1"))
1390+
self.assertTrue(triton_client.is_model_ready(libtorch_name, "1"))
13851391
# Version 3 did not exist in the first model repository, so
13861392
# it should still not be loaded.
1387-
self.assertFalse(triton_client.is_model_ready(plan_name, "3"))
1393+
self.assertFalse(triton_client.is_model_ready(libtorch_name, "3"))
13881394
except Exception as ex:
13891395
self.assertTrue(False, "unexpected error {}".format(ex))
13901396

1391-
self._infer_success_models(["libtorch", "onnx"], (1, 3), model_shape)
1397+
self._infer_success_models(["openvino", "onnx"], (1, 3), model_shape)
13921398

1393-
# Remove the plan from the first model repository and
1394-
# explicitly load plan. The plan from the second
1399+
# Remove the libtorch from the first model repository and
1400+
# explicitly load libtorch. The libtorch from the second
13951401
# model repository should be loaded properly. In the second
1396-
# model repository plan should have versions 1 and 3.
1397-
shutil.rmtree("models/" + plan_name)
1402+
# model repository libtorch should have versions 1 and 3.
1403+
shutil.rmtree("models/" + libtorch_name)
13981404
try:
13991405
triton_client = httpclient.InferenceServerClient(
14001406
"localhost:8000", verbose=True
14011407
)
14021408
# Unload existing in-memory model from first model repository
1403-
triton_client.unload_model(plan_name)
1409+
triton_client.unload_model(libtorch_name)
14041410
# Load model from second model repository since original was deleted
1405-
triton_client.load_model(plan_name)
1411+
triton_client.load_model(libtorch_name)
14061412
except Exception as ex:
1407-
self.assertIn("failed to load '{}'".format(plan_name), ex.message())
1413+
self.assertIn("failed to load '{}'".format(libtorch_name), ex.message())
14081414

1409-
self._infer_success_models(["plan", "libtorch", "onnx"], (1, 3), model_shape)
1415+
self._infer_success_models(
1416+
["libtorch", "openvino", "onnx"], (1, 3), model_shape
1417+
)
14101418

14111419
def test_model_control(self):
14121420
model_shape = (1, 16)
@@ -2249,12 +2257,11 @@ def test_model_repository_index(self):
22492257
# use model control EXPLICIT and --load-model to load a subset of models
22502258
# in model repository
22512259
tensor_shape = (1, 16)
2252-
model_bases = ["libtorch", "simple_libtorch"]
2260+
model_bases = ["plan", "libtorch", "simple_libtorch"]
22532261

22542262
# Sanity check on loaded models
2255-
# 3 models should be loaded:
2256-
# simple_plan_float32_float32_float32
2257-
# plan_float32_float32_float32
2263+
# 2 models should be loaded:
2264+
# simple_libtorch_float32_float32_float32
22582265
# libtorch_float32_float32_float32
22592266
for model_base in model_bases:
22602267
try:
@@ -2274,7 +2281,7 @@ def test_model_repository_index(self):
22742281
# Check model repository index
22752282
# All models should be in ready state except onnx_float32_float32_float32
22762283
# which appears in two repositories.
2277-
model_bases.append("simple_libtorch")
2284+
model_bases.append("simple_plan")
22782285
try:
22792286
triton_client = httpclient.InferenceServerClient(
22802287
"localhost:8000", verbose=True
@@ -3398,12 +3405,12 @@ def test_shutdown_with_live_connection(self):
33983405
)
33993406

34003407
def test_add_custom_config(self):
3401-
models_base = ("onnx",)
3408+
models_base = ("libtorch",)
34023409
models = list()
34033410
for m in models_base:
34043411
models.append(tu.get_model_name(m, np.float32, np.float32, np.float32))
34053412

3406-
# Make sure onnx and plan are in the status
3413+
# Make sure libtorch and plan are in the status
34073414
for model_name in models:
34083415
try:
34093416
for triton_client in (
@@ -3444,12 +3451,12 @@ def test_add_custom_config(self):
34443451
self.assertTrue(False, "unexpected error {}".format(ex))
34453452

34463453
def test_delete_custom_config(self):
3447-
models_base = ("onnx",)
3454+
models_base = ("libtorch",)
34483455
models = list()
34493456
for m in models_base:
34503457
models.append(tu.get_model_name(m, np.float32, np.float32, np.float32))
34513458

3452-
# Make sure plan is in the status
3459+
# Make sure libtorch and plan are in the status
34533460
for model_name in models:
34543461
try:
34553462
for triton_client in (

0 commit comments

Comments
 (0)