fix: unbuffer sidecar stdout so logs appear in journalctl

This commit is contained in:
root 2026-06-15 16:25:58 +00:00
parent 1e9305395e
commit 36abbf573e
2 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ EnvironmentFile=-/home/bigt/AI/llm/.env
Environment=MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml Environment=MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml
Environment=SIDECAR_PORT=8080 Environment=SIDECAR_PORT=8080
Environment=PATH=/home/bigt/AI/llm/venv/bin:/usr/local/bin:/usr/bin:/bin Environment=PATH=/home/bigt/AI/llm/venv/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONUNBUFFERED=1
# Use the sidecar's venv — install deps via deploy/README.md # Use the sidecar's venv — install deps via deploy/README.md
ExecStart=/home/bigt/AI/llm/venv/bin/uvicorn sidecar.app:app --host 0.0.0.0 --port 8080 ExecStart=/home/bigt/AI/llm/venv/bin/uvicorn sidecar.app:app --host 0.0.0.0 --port 8080

View File

@ -29,7 +29,7 @@ _switch_lock = threading.Lock() # Use threading.Lock for compatibility with Tes
@asynccontextmanager @asynccontextmanager
async def lifespan(app: FastAPI): async def lifespan(app: FastAPI):
"""Manage sidecar lifecycle — no default model loaded.""" """Manage sidecar lifecycle — no default model loaded."""
print(f"Sidecar starting, manifest={MANIFEST_PATH}, port={SIDECAR_PORT}") print(f"Sidecar starting, manifest={MANIFEST_PATH}, port={SIDECAR_PORT}", flush=True)
yield yield
# Cleanup: kill llama-server if running # Cleanup: kill llama-server if running
global _llama_server_process global _llama_server_process
@ -69,7 +69,7 @@ async def _start_llama_server(profile: dict):
for key, value in profile.get("flags", {}).items(): for key, value in profile.get("flags", {}).items():
cmd += ["--" + key, str(value)] cmd += ["--" + key, str(value)]
print(f"Starting llama-server: {' '.join(cmd)}") print(f"Starting llama-server: {' '.join(cmd)}", flush=True)
_llama_server_process = await asyncio.create_subprocess_exec( _llama_server_process = await asyncio.create_subprocess_exec(
*cmd, *cmd,
stdout=asyncio.subprocess.DEVNULL, stdout=asyncio.subprocess.DEVNULL,