mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-24 13:28:50 +01:00
This reverts commit 583fd6b000
.
This commit is contained in:
parent
9afdffe70e
commit
24ecb58168
@ -293,14 +293,13 @@ def start_server_background(args):
|
|||||||
|
|
||||||
|
|
||||||
def is_server_listening(server_fqdn, server_port):
|
def is_server_listening(server_fqdn, server_port):
|
||||||
try:
|
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
||||||
url = f"{server_fqdn}:{server_port}/health"
|
result = sock.connect_ex((server_fqdn, server_port))
|
||||||
if not url.startswith("http://"):
|
_is_server_listening = result == 0
|
||||||
url = f"http://{url}"
|
if _is_server_listening:
|
||||||
result = requests.get(url)
|
print(f"server is listening on {server_fqdn}:{server_port}...")
|
||||||
return result.status_code == 200
|
return _is_server_listening
|
||||||
except Exception:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def escape_metric_name(metric_name):
|
def escape_metric_name(metric_name):
|
||||||
return re.sub('[^A-Z0-9]', '_', metric_name.upper())
|
return re.sub('[^A-Z0-9]', '_', metric_name.upper())
|
||||||
|
Loading…
Reference in New Issue
Block a user