add fronted docker
This commit is contained in:
1 parent
5cd5ec5649
commit
a18f7a5c8b
14 files changed
+124
-24
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""현재 state부터 다음 게이트까지 단계를 이어 돌림
|
||||
어느 잡을 언제 돌릴지는 worker가 정하고 여기는 실행만 함
|
||||
"""
|
||||
import re
|
||||
import time
|
||||
import traceback
|
||||
|
||||
@@ -69,6 +70,16 @@ def reset_from(task, stage: str) -> None:
|
||||
task.state = state_type(stage)
|
||||
|
||||
|
||||
URL_IN_TEXT = re.compile(r"https?://\S+")
|
||||
MAX_ERROR_DETAIL = 500
|
||||
|
||||
|
||||
def safe_detail(failure: BaseException) -> str:
|
||||
"""검수 화면까지 가는 값이라 트레이스백과 스토리지 주소는 뺀다"""
|
||||
message = f"{type(failure).__name__}: {failure}"
|
||||
return URL_IN_TEXT.sub("<url>", message)[:MAX_ERROR_DETAIL]
|
||||
|
||||
|
||||
def stops_here(task, stage) -> str | None:
|
||||
"""이 단계 뒤에 사람이 볼 게이트가 서는가. playreel은 게이트 이름을 돌려준다"""
|
||||
if isinstance(task, PlayreelTask):
|
||||
@@ -115,14 +126,15 @@ async def run_until_gate(session: AsyncSession, task) -> None:
|
||||
while task.state != state_type.COMPLETED:
|
||||
if not await step(session, task):
|
||||
return
|
||||
except Exception:
|
||||
except Exception as failure:
|
||||
failed_stage = str(task.state)
|
||||
traceback.print_exc() # 전문은 서버 로그에만 남긴다
|
||||
await session.rollback()
|
||||
await session.refresh(task)
|
||||
mark(task, failed_stage, FAILED)
|
||||
task.status = FAILED
|
||||
task.error_stage = failed_stage
|
||||
task.error_detail = traceback.format_exc()[-2000:]
|
||||
task.error_detail = safe_detail(failure)
|
||||
await session.commit()
|
||||
return
|
||||
|
||||
|
||||
Reference in new issue
Block a user