From 9d57a1fab4505be931500b8348765a600b7d0630 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Thu, 10 Aug 2023 17:42:09 +0000 Subject: [PATCH] metrics: Use check containers are up in tensorflow script This PR uses the check containers are up from the common script in the tensorflow script. Signed-off-by: Gabriela Cervantes --- tests/metrics/machine_learning/tensorflow.sh | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tests/metrics/machine_learning/tensorflow.sh b/tests/metrics/machine_learning/tensorflow.sh index 7f11319272..5a2d7cb1e4 100755 --- a/tests/metrics/machine_learning/tensorflow.sh +++ b/tests/metrics/machine_learning/tensorflow.sh @@ -150,17 +150,6 @@ EOF metrics_json_end_array "Results" } -function check_containers_are_up() { - local containers_launched=0 - for i in $(seq "${TIMEOUT}") ; do - info "Verify that the containers are running" - containers_launched="$(sudo ${CTR_EXE} t list | grep -c "RUNNING")" - [ "${containers_launched}" -eq "${NUM_CONTAINERS}" ] && break - sleep 1 - [ "${i}" == "${TIMEOUT}" ] && return 1 - done -} - function main() { # Verify enough arguments if [ "$#" -lt 2 ]; then @@ -195,11 +184,11 @@ function main() { metrics_json_start_array # Check that the requested number of containers are running - check_containers_are_up + check_containers_are_up "${NUM_CONTAINERS}" # Check that the requested number of containers are running local timeout_launch="10" - check_containers_are_up & pid=$! + check_containers_are_up "${NUM_CONTAINERS}" & pid=$! (sleep "${timeout_launch}" && kill -HUP "${pid}") 2>/dev/null & pid_tout=$! if wait "${pid}" 2>/dev/null; then