feat(curator): 큐레이션 후 텔레그램 자동 푸시 + cron 09:00 변경
This commit is contained in:
@@ -27,11 +27,21 @@ class LottoAgent(BaseAgent):
|
|||||||
await self.transition("working", "후보 수집 및 AI 큐레이션 중...", task_id)
|
await self.transition("working", "후보 수집 및 AI 큐레이션 중...", task_id)
|
||||||
try:
|
try:
|
||||||
result = await curate_weekly(source=source)
|
result = await curate_weekly(source=source)
|
||||||
update_task_status(task_id, "succeeded", result_data=result)
|
update_task_status(task_id, "succeeded", result_data={
|
||||||
|
k: v for k, v in result.items() if k != "payload"
|
||||||
|
})
|
||||||
await self.transition("reporting", f"#{result['draw_no']} 브리핑 저장 완료")
|
await self.transition("reporting", f"#{result['draw_no']} 브리핑 저장 완료")
|
||||||
add_log(self.agent_id, f"큐레이션 완료: #{result['draw_no']} conf={result['confidence']}", task_id=task_id)
|
add_log(self.agent_id, f"큐레이션 완료: #{result['draw_no']} conf={result['confidence']}", task_id=task_id)
|
||||||
|
|
||||||
|
# 텔레그램 헤드라인 푸시 (실패해도 큐레이션은 성공으로 마감)
|
||||||
|
try:
|
||||||
|
from ..notifiers.telegram_lotto import send_curator_briefing
|
||||||
|
await send_curator_briefing(result["payload"])
|
||||||
|
except Exception as e:
|
||||||
|
add_log(self.agent_id, f"텔레그램 알림 실패: {e}", level="warning", task_id=task_id)
|
||||||
|
|
||||||
await self.transition("idle", "대기 중")
|
await self.transition("idle", "대기 중")
|
||||||
return {"ok": True, **result}
|
return {"ok": True, **{k: v for k, v in result.items() if k != "payload"}}
|
||||||
except CuratorError as e:
|
except CuratorError as e:
|
||||||
update_task_status(task_id, "failed", result_data={"error": str(e)})
|
update_task_status(task_id, "failed", result_data={"error": str(e)})
|
||||||
add_log(self.agent_id, f"큐레이션 실패: {e}", level="error", task_id=task_id)
|
add_log(self.agent_id, f"큐레이션 실패: {e}", level="error", task_id=task_id)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ async def _poll_pipelines():
|
|||||||
def init_scheduler():
|
def init_scheduler():
|
||||||
scheduler.add_job(_run_stock_schedule, "cron", hour=7, minute=30, id="stock_news")
|
scheduler.add_job(_run_stock_schedule, "cron", hour=7, minute=30, id="stock_news")
|
||||||
scheduler.add_job(_run_blog_schedule, "cron", hour=10, minute=0, id="blog_pipeline")
|
scheduler.add_job(_run_blog_schedule, "cron", hour=10, minute=0, id="blog_pipeline")
|
||||||
scheduler.add_job(_run_lotto_schedule, "cron", day_of_week="mon", hour=7, minute=0, id="lotto_curate")
|
scheduler.add_job(_run_lotto_schedule, "cron", day_of_week="mon", hour=9, minute=0, id="lotto_curate")
|
||||||
scheduler.add_job(_run_youtube_research, "cron", hour=9, minute=0, id="youtube_research")
|
scheduler.add_job(_run_youtube_research, "cron", hour=9, minute=0, id="youtube_research")
|
||||||
scheduler.add_job(_send_youtube_weekly_report, "cron", day_of_week="mon", hour=8, minute=0, id="youtube_weekly_report")
|
scheduler.add_job(_send_youtube_weekly_report, "cron", day_of_week="mon", hour=8, minute=0, id="youtube_weekly_report")
|
||||||
scheduler.add_job(_check_idle_breaks, "interval", seconds=60, id="idle_check")
|
scheduler.add_job(_check_idle_breaks, "interval", seconds=60, id="idle_check")
|
||||||
|
|||||||
Reference in New Issue
Block a user