fix: 단독 P2V 워커가 모델 미등록으로 큐를 처리하지 못하던 문제 수정
- standalone 이 main 을 import 하지 않아 첫 DB 조회에서 매퍼 설정 오류가 나고, loop() 의 requeue_running 이 try 밖이라 워커 태스크만 조용히 죽던 문제 - standalone 이 모델을 직접 등록하고, 워커 루프가 예기치 않게 끝나면 프로세스도 비정상 종료(restart 로 복구) - 기동 시 requeue_running 실패를 재시도하도록 loop 보강, start() 가 태스크를 반환
This commit is contained in:
1 parent
a92432867c
commit
50899861d0
2 files changed
+31
-7
No files matched your search
@@ -53,7 +53,17 @@ async def requeue_running() -> None:
|
||||
|
||||
|
||||
async def loop() -> None:
|
||||
await requeue_running()
|
||||
# 기동 시 일시적인 오류(DB 연결 등)로 워커가 조용히 죽지 않게, 성공할 때까지 재시도한다.
|
||||
# 이 줄이 try 밖에 있으면 예외 하나로 태스크만 죽고 프로세스는 살아 있어 큐가 멈춘다
|
||||
while True:
|
||||
try:
|
||||
await requeue_running()
|
||||
break
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
await asyncio.sleep(POLL_INTERVAL)
|
||||
while True:
|
||||
try:
|
||||
if not await run_once():
|
||||
@@ -66,9 +76,10 @@ async def loop() -> None:
|
||||
await asyncio.sleep(POLL_INTERVAL)
|
||||
|
||||
|
||||
def start() -> None:
|
||||
def start() -> asyncio.Task:
|
||||
global _worker
|
||||
_worker = asyncio.create_task(loop(), name="pipeline-worker")
|
||||
return _worker
|
||||
|
||||
|
||||
async def stop() -> None:
|
||||
|
||||
Reference in new issue
Block a user