Skip to content

Commit 41844a8

Browse files
authored
test: Improve L0_logging stability (#7486)
1 parent 69d768d commit 41844a8

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

qa/L0_logging/log_format_test.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ def _launch_server(self, escaped=None):
405405
if not os.path.exists(self._server_options["log-file"]):
406406
raise Exception("Log not found")
407407

408+
# Give server a little time to have the endpoints up and ready
409+
time.sleep(10)
410+
408411
def _validate_log_record(self, record, format_regex, escaped):
409412
match = format_regex.search(record)
410413
assert match, "Invalid log line"
@@ -483,18 +486,29 @@ def test_injection(self, log_format, format_regex, injected_record):
483486
# TODO Refactor server launch, shutdown into reusable class
484487
wait_time = 10
485488

486-
while wait_time and not triton_client.is_server_ready():
489+
while wait_time:
490+
try:
491+
if triton_client.is_server_ready():
492+
break
493+
# Gracefully handle connection error if server endpoint isn't up yet
494+
except Exception as e:
495+
print(
496+
f"Client failed to connect, retries remaining: {wait_time}. Error: {e}"
497+
)
498+
487499
time.sleep(1)
488500
wait_time -= 1
501+
print(f"Server not ready yet, retries remaining: {wait_time}")
489502

490503
while wait_time and not triton_client.is_model_ready("simple"):
491504
time.sleep(1)
492505
wait_time -= 1
493506

494-
if not triton_client.is_server_ready() or not triton_client.is_model_ready(
495-
"simple"
496-
):
497-
raise Exception("Model or Server not Ready")
507+
if not triton_client.is_server_ready():
508+
raise Exception("Server not Ready")
509+
510+
if not triton_client.is_model_ready("simple"):
511+
raise Exception("Model not Ready")
498512

499513
except Exception as e:
500514
self._shutdown_server()

qa/L0_logging/test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# Copyright 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -60,6 +60,11 @@ source ../common/util.sh
6060
rm -f *.log
6161
rm -fr $MODELSDIR && mkdir -p $MODELSDIR
6262

63+
if [ ! -d ${DATADIR} ]; then
64+
echo -e "\n***\n*** ${DATADIR} does not exist!\n***"
65+
exit 1
66+
fi
67+
6368
# set up simple repository MODELBASE
6469
rm -fr $MODELSDIR && mkdir -p $MODELSDIR && \
6570
cp -r $DATADIR/$MODELBASE $MODELSDIR/simple && \

0 commit comments

Comments
 (0)