Spaces:
Running
Running
log ace-server restart, show output for adapter debugging
Browse files
app.py
CHANGED
|
@@ -246,6 +246,7 @@ _ace_proc = None
|
|
| 246 |
def _stop_ace_server():
|
| 247 |
"""Stop ace-server process."""
|
| 248 |
global _ace_proc
|
|
|
|
| 249 |
if _ace_proc and _ace_proc.poll() is None:
|
| 250 |
_ace_proc.terminate()
|
| 251 |
try:
|
|
@@ -253,11 +254,13 @@ def _stop_ace_server():
|
|
| 253 |
except subprocess.TimeoutExpired:
|
| 254 |
_ace_proc.kill()
|
| 255 |
_ace_proc = None
|
|
|
|
| 256 |
else:
|
| 257 |
try:
|
| 258 |
subprocess.run(["pkill", "ace-server"],
|
| 259 |
stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
| 260 |
timeout=10)
|
|
|
|
| 261 |
except Exception:
|
| 262 |
pass
|
| 263 |
time.sleep(1)
|
|
@@ -266,20 +269,22 @@ def _stop_ace_server():
|
|
| 266 |
def _start_ace_server():
|
| 267 |
"""Start ace-server in background and wait for health."""
|
| 268 |
global _ace_proc
|
|
|
|
| 269 |
try:
|
| 270 |
_ace_proc = subprocess.Popen(
|
| 271 |
[ACE_SERVER_BIN, "--host", "127.0.0.1", "--port", "8085",
|
| 272 |
"--models", MODELS_DIR, "--adapters", ADAPTER_DIR, "--max-batch", "1"],
|
| 273 |
-
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
| 274 |
)
|
| 275 |
except Exception as exc:
|
| 276 |
-
logger.error("Failed to start
|
| 277 |
return False
|
| 278 |
|
| 279 |
for _ in range(30):
|
| 280 |
if _server_ok():
|
|
|
|
| 281 |
return True
|
| 282 |
time.sleep(2)
|
|
|
|
| 283 |
return False
|
| 284 |
|
| 285 |
|
|
|
|
| 246 |
def _stop_ace_server():
|
| 247 |
"""Stop ace-server process."""
|
| 248 |
global _ace_proc
|
| 249 |
+
logger.info("[ace-server] Stopping...")
|
| 250 |
if _ace_proc and _ace_proc.poll() is None:
|
| 251 |
_ace_proc.terminate()
|
| 252 |
try:
|
|
|
|
| 254 |
except subprocess.TimeoutExpired:
|
| 255 |
_ace_proc.kill()
|
| 256 |
_ace_proc = None
|
| 257 |
+
logger.info("[ace-server] Stopped (tracked PID)")
|
| 258 |
else:
|
| 259 |
try:
|
| 260 |
subprocess.run(["pkill", "ace-server"],
|
| 261 |
stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
| 262 |
timeout=10)
|
| 263 |
+
logger.info("[ace-server] Stopped (pkill)")
|
| 264 |
except Exception:
|
| 265 |
pass
|
| 266 |
time.sleep(1)
|
|
|
|
| 269 |
def _start_ace_server():
|
| 270 |
"""Start ace-server in background and wait for health."""
|
| 271 |
global _ace_proc
|
| 272 |
+
logger.info("[ace-server] Starting with --adapters %s", ADAPTER_DIR)
|
| 273 |
try:
|
| 274 |
_ace_proc = subprocess.Popen(
|
| 275 |
[ACE_SERVER_BIN, "--host", "127.0.0.1", "--port", "8085",
|
| 276 |
"--models", MODELS_DIR, "--adapters", ADAPTER_DIR, "--max-batch", "1"],
|
|
|
|
| 277 |
)
|
| 278 |
except Exception as exc:
|
| 279 |
+
logger.error("[ace-server] Failed to start: %s", exc)
|
| 280 |
return False
|
| 281 |
|
| 282 |
for _ in range(30):
|
| 283 |
if _server_ok():
|
| 284 |
+
logger.info("[ace-server] Healthy")
|
| 285 |
return True
|
| 286 |
time.sleep(2)
|
| 287 |
+
logger.error("[ace-server] Health check timeout")
|
| 288 |
return False
|
| 289 |
|
| 290 |
|