M5: Windows 에서 파인튜닝 자식 프로세스가 멈추던 문제, win-ci npm 호출 수정

- 워커가 띄우는 자식(finetune/run.py, nvidia-smi)에 stdin 을 물려주지 않는다 (요청 파이프 상속 → 시작 단계에서 멈춤)
- win-ci: PowerShell 파이프라인 안에서 npm.ps1 이 인자를 잘못 읽어 'Unknown command: pm' → npm.cmd 로 호출

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 03:46:49 +09:00
parent e6723a49ea
commit ae2af637ad
3 changed files with 7 additions and 4 deletions

View File

@@ -129,9 +129,9 @@ try {
if ($Phase -eq 'full') {
$r['app_build'] = Step 'app_build' {
Push-Location (Join-Path $Repo 'app')
& npm ci --no-audit --no-fund
& npm.cmd ci --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { Pop-Location; throw "npm ci exit $LASTEXITCODE" }
& npm run dist:win
& npm.cmd run dist:win
$c = $LASTEXITCODE
Pop-Location
if ($c -ne 0) { throw "electron-builder exit $c" }

View File

@@ -68,7 +68,8 @@ def _run_smi(args: list[str]) -> str | None:
return None
try:
flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
out = subprocess.run([exe, *args], capture_output=True, text=True, timeout=10, creationflags=flags)
out = subprocess.run([exe, *args], stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=10,
creationflags=flags) # stdin 을 물려주지 않는다 (main.run_finetune 참고)
except (OSError, subprocess.TimeoutExpired) as e:
log.info("nvidia-smi 실행 실패: %s", e)
return None

View File

@@ -148,7 +148,9 @@ def run_finetune(req: dict[str, Any], ctx: Context) -> dict[str, Any]:
elif v not in (None, False):
cmd += [flag, str(v)]
flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="utf-8",
# stdin 은 꼭 끊는다. 워커 stdin(요청 파이프)을 물려받으면 Windows 에서 자식의 런타임 초기화(GetFileType)가
# 주 스레드의 읽기 대기와 엉켜 자식이 시작조차 못 하고 멈춘다 (win-ci: train 요청 120초 응답 없음).
proc = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="utf-8",
errors="replace", creationflags=flags, env={**os.environ, "PYTHONIOENCODING": "utf-8"})
err_tail: deque[str] = deque(maxlen=30)