From 24ecb58168dce81646c2ed425690a106591c8c6d Mon Sep 17 00:00:00 2001 From: Pierrick Hymbert Date: Thu, 16 May 2024 20:43:45 +0200 Subject: [PATCH] Revert "server bench: fix bench not waiting for model load (#7284)" (#7334) This reverts commit 583fd6b000ec9ad1b465b5c98524f4a0ae388077. --- examples/server/bench/bench.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/server/bench/bench.py b/examples/server/bench/bench.py index 25ac29c4c..86c5de101 100644 --- a/examples/server/bench/bench.py +++ b/examples/server/bench/bench.py @@ -293,14 +293,13 @@ def start_server_background(args): def is_server_listening(server_fqdn, server_port): - try: - url = f"{server_fqdn}:{server_port}/health" - if not url.startswith("http://"): - url = f"http://{url}" - result = requests.get(url) - return result.status_code == 200 - except Exception: - return False + with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: + result = sock.connect_ex((server_fqdn, server_port)) + _is_server_listening = result == 0 + if _is_server_listening: + print(f"server is listening on {server_fqdn}:{server_port}...") + return _is_server_listening + def escape_metric_name(metric_name): return re.sub('[^A-Z0-9]', '_', metric_name.upper())