fix: 주간 자동학습 lambda async 버그 수정 (learn_weights/learn_pricing)
일요일 가중치·가격모델 학습이 lambda:coro()로 등록돼 APScheduler가 await 못해 실제로 안 돌던 버그(weight_config 05-24 이후 스케줄 갱신 0) → 명명 코루틴 함수 (_learn_weights_job/_learn_pricing_job)로 교체. learn_weights 수동검증 OK(표본10,683). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3033,6 +3033,12 @@ async def _daily_score_notify():
|
||||
(lambda로 감싸면 coroutine never awaited 버그)."""
|
||||
await calculate_daily_scores(notify=True)
|
||||
|
||||
async def _learn_weights_job():
|
||||
await learn_weights(days=90, segment="all")
|
||||
|
||||
async def _learn_pricing_job():
|
||||
await learn_pricing(days=90, segment="all", target="return_7d", n_folds=5)
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
global pg_pool, redis_cl
|
||||
@@ -3085,11 +3091,10 @@ async def startup():
|
||||
# 04:00 — 공식 가중치 학습 (90일 백테스트)
|
||||
# 05:00 — 예상가 모델 학습 (선형회귀 + RF + XGBoost)
|
||||
# 두 함수 모두 표본 부족 시 graceful (return early) — 데이터 누적되면 자동 활성화
|
||||
scheduler.add_job(lambda: learn_weights(days=90, segment="all"), "cron",
|
||||
scheduler.add_job(_learn_weights_job, "cron",
|
||||
day_of_week="sun", hour=4, minute=0,
|
||||
id="learn_weights", replace_existing=True)
|
||||
scheduler.add_job(lambda: learn_pricing(days=90, segment="all",
|
||||
target="return_7d", n_folds=5), "cron",
|
||||
scheduler.add_job(_learn_pricing_job, "cron",
|
||||
day_of_week="sun", hour=5, minute=0,
|
||||
id="learn_pricing", replace_existing=True)
|
||||
# AI 심층분석 — 비용 폭주로 자동 호출 임시 비활성화 (2026-05-29)
|
||||
|
||||
Reference in New Issue
Block a user