Skip to content

feat: 리포트 생성 worker를 cpu-worker에 통합 (별도 Deployment 없이) - #85

Closed
gpffh20 wants to merge 1 commit into
mainfrom
feat/report-generation-worker-in-cpu-worker
Closed

gpffh20 wants to merge 1 commit into
mainfrom
feat/report-generation-worker-in-cpu-worker

Conversation

@gpffh20

@gpffh20 gpffh20 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

개요

5-Agent 리포트 생성 SQS 워커(report_generation_worker.py)를 별도 Deployment로 새로 안 만들고, 기존 cpu-worker pod 안에 세 번째 폴링 스레드로 얹습니다.

cpu_worker.py는 이미 audio-preprocess(메인 스레드)와 legacy report-analysis(백그라운드 스레드) 두 개의 SQS 큐를 한 pod에서 멀티스레드로 처리하고 있었습니다 - 여기에 같은 패턴으로 세 번째 스레드만 추가했습니다. 새 워커 하나 만들 때마다 Deployment/ScaledObject/IRSA 역할을 새로 파는 대신, 이미 있는 DB/Bedrock/AgentCore Gateway 접근 권한을 그대로 재사용합니다.

변경

  • report_generation_worker.py의 private _run_loop()를 public run_loop()로 (cpu_worker.py에서 직접 import해서 스레드로 돌리기 위함 - initialize_observability() 중복 호출을 피하려고 start_worker()를 통하지 않음)
  • cpu_worker.py의 start_worker()에 세 번째 daemon thread 추가

검증

  • pytest tests/ 179 passed
  • ruff check 통과
  • import app.workers.cpu_worker 정상 (순환 임포트 등 없음)

남은 작업 (Infra repo, 별도 PR)

  • SQS 큐(report_generation_queue) 생성
  • cpu-worker의 IRSA 역할에 새 큐 권한 + AgentCore Gateway invoke 권한 추가
  • cpu-worker Deployment에 SQS_REPORT_GENERATION_QUEUE_URL 환경변수 추가

…loyment)

cpu_worker.py already runs multiple SQS consumer loops as daemon threads
in one process/pod (audio preprocess on the main thread, the legacy
report-analysis loop on a background thread) - this adds a third thread
for the new 5-agent report generation queue instead of standing up a
separate Deployment/ScaledObject/IRSA role for it. Same queue-per-thread
pattern already established here, reusing the pod's existing DB/Bedrock/
AgentCore Gateway network access and IAM permissions.

report_generation_worker.run_loop() (renamed from the private _run_loop)
is called directly rather than through start_worker(), since
initialize_observability() should only run once per process and
cpu_worker.py's own start_worker() already calls it.
@gpffh20 gpffh20 closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant