Auto-commit: OCR workflow improvements, performance optimizations, and bug fixes
This commit is contained in:
73
test_server_start.py
Normal file
73
test_server_start.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
def start_server():
|
||||
"""Start the LightRAG server in a subprocess"""
|
||||
print("Starting LightRAG server...")
|
||||
|
||||
# Kill any existing server on port 3015
|
||||
try:
|
||||
subprocess.run(["taskkill", "/F", "/IM", "python.exe"], capture_output=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Start the server
|
||||
cmd = [sys.executable, "start_server_fixed.py"]
|
||||
process = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
encoding='utf-8',
|
||||
bufsize=1,
|
||||
universal_newlines=True
|
||||
)
|
||||
|
||||
# Wait a bit for server to start
|
||||
time.sleep(3)
|
||||
|
||||
# Check if process is still running
|
||||
if process.poll() is not None:
|
||||
print("Server process exited!")
|
||||
# Read output
|
||||
output, _ = process.communicate()
|
||||
print("Server output:")
|
||||
print(output[:1000]) # Print first 1000 chars
|
||||
return False, process
|
||||
|
||||
print("Server appears to be running")
|
||||
return True, process
|
||||
|
||||
def check_server_health():
|
||||
"""Check if server is responding"""
|
||||
import requests
|
||||
try:
|
||||
response = requests.get("http://localhost:3015/health", timeout=5)
|
||||
print(f"Server health check: {response.status_code}")
|
||||
print(f"Response: {response.text[:500]}")
|
||||
return response.status_code == 200
|
||||
except Exception as e:
|
||||
print(f"Health check failed: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Testing server startup...")
|
||||
success, process = start_server()
|
||||
|
||||
if success:
|
||||
print("Server started successfully, checking health...")
|
||||
time.sleep(2)
|
||||
if check_server_health():
|
||||
print("✓ Server is fully operational!")
|
||||
else:
|
||||
print("✗ Server started but health check failed")
|
||||
else:
|
||||
print("✗ Server failed to start")
|
||||
|
||||
# Clean up
|
||||
if process and process.poll() is None:
|
||||
print("Terminating server process...")
|
||||
process.terminate()
|
||||
process.wait()
|
||||
Reference in New Issue
Block a user