feat(agent-office/scheduler): 매일 03:00 agent_logs 90일 retention cleanup
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import asyncio
|
||||
import logging
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
from .agents import AGENT_REGISTRY
|
||||
from .db import delete_old_logs
|
||||
|
||||
scheduler = AsyncIOScheduler(timezone="Asia/Seoul")
|
||||
|
||||
@@ -81,6 +83,11 @@ async def _poll_pipelines():
|
||||
if agent:
|
||||
await agent.poll_state_changes()
|
||||
|
||||
def _cleanup_old_logs():
|
||||
n = delete_old_logs(days=90)
|
||||
if n:
|
||||
logging.getLogger(__name__).info("delete_old_logs: %d rows removed", n)
|
||||
|
||||
def init_scheduler():
|
||||
scheduler.add_job(_run_stock_schedule, "cron", hour=7, minute=30, id="stock_news")
|
||||
scheduler.add_job(
|
||||
@@ -117,4 +124,5 @@ 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(_cleanup_old_logs, "cron", hour=3, minute=0, id="cleanup_old_logs", replace_existing=True)
|
||||
scheduler.start()
|
||||
|
||||
Reference in New Issue
Block a user