feat(music-lab): get_last_failed_step — 파이프라인 재개용 실패 step 판별

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-12 00:18:07 +09:00
parent 51eff1538e
commit d638666659
2 changed files with 36 additions and 0 deletions

View File

@@ -1220,6 +1220,18 @@ def list_pipeline_jobs(pid: int) -> List[Dict[str, Any]]:
return [dict(r) for r in rows]
def get_last_failed_step(pid: int) -> Optional[str]:
"""파이프라인의 가장 최근 status='failed' pipeline_job의 step. 없으면 None."""
with _conn() as conn:
row = conn.execute(
"SELECT step FROM pipeline_jobs "
"WHERE pipeline_id = ? AND status = 'failed' "
"ORDER BY id DESC LIMIT 1",
(pid,),
).fetchone()
return row["step"] if row else None
def get_youtube_setup() -> Dict[str, Any]:
"""youtube_setup의 기본 1행을 반환. 누락 시 자동 시드 후 재조회."""
with _conn() as conn: