Find Maia UCI binary from deploy venv
All checks were successful
Deploy Blog Backend / test (push) Successful in 1m19s
Deploy Blog Backend / deploy (push) Successful in 1m25s

This commit is contained in:
박원엽
2026-06-19 16:30:03 +09:00
parent abb20cfe6d
commit bd08af5d59
2 changed files with 18 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ Environment=MAIA_DEVICE=cpu
Environment=MAIA_USE_AMP=false
Environment=HF_HOME=/root/blog-backend/.cache/huggingface
Environment=PYTHONUNBUFFERED=1
Environment=PATH=/root/blog-backend/maia-engine-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/root/blog-backend/maia-engine-venv/bin/python -m uvicorn app.main:app --host 127.0.0.1 --port 8000
Restart=always
RestartSec=5

View File

@@ -1,7 +1,10 @@
import os
import shutil
import subprocess
import sys
import threading
from datetime import datetime, timezone
from pathlib import Path
import chess
import chess.engine
@@ -37,9 +40,22 @@ def model_alias(model: str) -> str:
return f"maia3-{model}"
def engine_executable() -> str:
executable_name = "maia3-uci.exe" if os.name == "nt" else "maia3-uci"
venv_executable = Path(sys.executable).with_name(executable_name)
if venv_executable.exists():
return str(venv_executable)
path_executable = shutil.which("maia3-uci")
if path_executable:
return path_executable
return "maia3-uci"
def engine_command(model: str) -> list[str]:
command = [
"maia3-uci",
engine_executable(),
"--model",
model_alias(model),
"--use-uci-history",