feat(agent-office): 노드 헬스 1분 cron + 텔레그램 경보(다운/복구/dead-letter)

This commit is contained in:
2026-06-29 18:06:38 +09:00
parent 2a0090a1d4
commit 5d5ff27d29
3 changed files with 73 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
from .agents import AGENT_REGISTRY
from .db import delete_old_logs
from . import node_monitor
scheduler = AsyncIOScheduler(timezone="Asia/Seoul")
@@ -98,6 +99,9 @@ async def _poll_pipelines():
if agent:
await agent.poll_state_changes()
async def _run_node_health_check():
await node_monitor.check_and_alert()
def _cleanup_old_logs():
n = delete_old_logs(days=90)
if n:
@@ -142,5 +146,6 @@ def init_scheduler():
scheduler.add_job(_run_youtube_research, "cron", hour=9, minute=10, 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(_poll_pipelines, "interval", seconds=30, id="pipeline_poll")
scheduler.add_job(_run_node_health_check, "interval", seconds=60, id="node_health_check", replace_existing=True)
scheduler.add_job(_cleanup_old_logs, "cron", hour=3, minute=0, id="cleanup_old_logs", replace_existing=True)
scheduler.start()