Skip to content

Commit

Permalink
server bench: fix bench not waiting for model load (ggerganov#7284)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesGaessler committed May 15, 2024
1 parent 9f77348 commit 583fd6b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions examples/server/bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,14 @@ def server_log(in_stream, out_stream):


def is_server_listening(server_fqdn, server_port):
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

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

def escape_metric_name(metric_name):
return re.sub('[^A-Z0-9]', '_', metric_name.upper())
Expand Down

0 comments on commit 583fd6b

Please sign in to comment.