Skip to content

SOTA Open Source TTS

add script to wait server

Lengyuedcc2a0389730
diff --git a/tools/llama/wait_data_server.py b/tools/llama/wait_data_server.py
new file mode 100644
index 0000000..2028ae5
--- /dev/null
+++ b/tools/llama/wait_data_server.py
@@ -0,0 +1,25 @@
+import socket
+import time
+
+import click
+
+
[email protected]("--host", default="127.0.0.1", help="Host to connect to")
[email protected]("--port", default=50051, help="Port to connect to")
+def wait_data_server(host, port):
+ """Wait for the data server to be ready"""
+
+ while True:
+ try:
+ with socket.create_connection((host, port)):
+ break
+ except ConnectionRefusedError:
+ click.echo("Server is not ready yet! Waiting...")
+ time.sleep(1)
+
+ click.echo("Server is ready! Starting training...")
+
+
+if __name__ == "__main__":
+ wait_data_server()