fix: improve AI feature install error handling and resource limits

Handle OOM kills (exit code 137) with actionable memory guidance,
filter ANSI/progress noise from error output, add --no-cache-dir to
pip installs, reduce download concurrency to 2, and bump default
container memory from 4g to 6g.
This commit is contained in:
SnapOtter
2026-05-18 10:19:43 +08:00
parent d978ae211b
commit 36431bce48
3 changed files with 22 additions and 11 deletions
+2 -2
View File
@@ -125,7 +125,7 @@ def check_disk_space(path: str, min_bytes: int = 100 * 1024 * 1024) -> None:
def pip_install(package: str, extra_flags: list[str] | None = None) -> None:
"""Run pip install for a single package spec. Raises on failure."""
cmd = [sys.executable, "-m", "pip", "install"]
cmd = [sys.executable, "-m", "pip", "install", "--no-cache-dir"]
if extra_flags:
cmd.extend(extra_flags)
@@ -471,7 +471,7 @@ def download_models(models: list[dict], models_dir: str) -> list[str]:
except Exception as e:
return (model_id, e)
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool:
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:
futures = {
pool.submit(_download, i, m): i
for i, m in enumerate(models)