Peter Michael Gits Claude commited on
Commit
f18289a
Β·
1 Parent(s): 593a7cc

Enhance Rust server startup debugging and fix version

Browse files

- Fix version mismatch in Dockerfile (v1.1.5 β†’ v1.2.1)
- Add detailed startup logging to identify why Rust server isn't appearing in logs
- Add command line logging and PID tracking
- Add better error handling for process exit codes
- Keep correct config for pre-loaded 1B multilingual model

This should help identify why WebSocket connections work but no Rust server
logs are appearing in the HuggingFace Space deployment.

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (3) hide show
  1. Dockerfile +1 -1
  2. app.py +14 -0
  3. test_websocket.py +31 -0
Dockerfile CHANGED
@@ -189,7 +189,7 @@ EXPOSE 7860
189
 
190
  # Create startup script
191
  RUN echo '#!/bin/bash\n\
192
- echo "πŸš€ Starting Kyutai STT Server v1.1.5 with pre-loaded models..."\n\
193
  echo "πŸ“ Pre-loaded models:"\n\
194
  ls -lah models/kyutai/stt-1b-en_fr-candle/ || echo "No pre-loaded models found"\n\
195
  echo "GPU Info:"\n\
 
189
 
190
  # Create startup script
191
  RUN echo '#!/bin/bash\n\
192
+ echo "πŸš€ Starting Kyutai STT Server v1.2.1 with pre-loaded models..."\n\
193
  echo "πŸ“ Pre-loaded models:"\n\
194
  ls -lah models/kyutai/stt-1b-en_fr-candle/ || echo "No pre-loaded models found"\n\
195
  echo "GPU Info:"\n\
app.py CHANGED
@@ -58,6 +58,7 @@ def start_rust_server():
58
 
59
  for config in server_configs:
60
  print(f"πŸ”§ Trying {config['name']} mode...")
 
61
  try:
62
  rust_process = subprocess.Popen(
63
  config["args"],
@@ -67,6 +68,7 @@ def start_rust_server():
67
  bufsize=1,
68
  universal_newlines=True
69
  )
 
70
 
71
  # Monitor server startup for this attempt
72
  def monitor_output():
@@ -104,10 +106,22 @@ def start_rust_server():
104
  return True
105
  else:
106
  print("⏰ Timeout waiting for Rust server to start")
 
 
 
 
 
 
 
 
 
 
107
  return False
108
 
109
  except Exception as e:
110
  print(f"❌ Error starting Rust server: {e}")
 
 
111
  return False
112
 
113
  def stop_rust_server():
 
58
 
59
  for config in server_configs:
60
  print(f"πŸ”§ Trying {config['name']} mode...")
61
+ print(f"πŸ”§ Command: {' '.join(config['args'])}")
62
  try:
63
  rust_process = subprocess.Popen(
64
  config["args"],
 
68
  bufsize=1,
69
  universal_newlines=True
70
  )
71
+ print(f"πŸ”§ Rust process started with PID: {rust_process.pid}")
72
 
73
  # Monitor server startup for this attempt
74
  def monitor_output():
 
106
  return True
107
  else:
108
  print("⏰ Timeout waiting for Rust server to start")
109
+ if rust_process.poll() is not None:
110
+ # Process exited, try to get the return code and output
111
+ return_code = rust_process.returncode
112
+ print(f"❌ Rust server process exited with code: {return_code}")
113
+ try:
114
+ remaining_output = rust_process.stdout.read()
115
+ if remaining_output:
116
+ print(f"Final output: {remaining_output}")
117
+ except:
118
+ pass
119
  return False
120
 
121
  except Exception as e:
122
  print(f"❌ Error starting Rust server: {e}")
123
+ if rust_process and rust_process.poll() is not None:
124
+ print(f"Process exit code: {rust_process.returncode}")
125
  return False
126
 
127
  def stop_rust_server():
test_websocket.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import asyncio
3
+ import websockets
4
+ import json
5
+ import ssl
6
+
7
+ async def test_websocket():
8
+ uri = "wss://pgits-stt-gpu-service-v3.hf.space/ws"
9
+ try:
10
+ print(f"Connecting to {uri}...")
11
+ ssl_context = ssl.create_default_context()
12
+ ssl_context.check_hostname = False
13
+ ssl_context.verify_mode = ssl.CERT_NONE
14
+
15
+ async with websockets.connect(uri, ssl=ssl_context) as websocket:
16
+ print("βœ… Connected!")
17
+
18
+ # Send test start message
19
+ start_msg = {"type": "start", "config": {"enable_timestamps": True}}
20
+ await websocket.send(json.dumps(start_msg))
21
+ print(f"Sent: {start_msg}")
22
+
23
+ # Wait for response
24
+ response = await asyncio.wait_for(websocket.recv(), timeout=10.0)
25
+ print(f"Received: {response}")
26
+
27
+ except Exception as e:
28
+ print(f"❌ Connection failed: {e}")
29
+
30
+ if __name__ == "__main__":
31
+ asyncio.run(test_websocket())