From 04ab01a166d50f118557a32a5645f69fcbf8bb72 Mon Sep 17 00:00:00 2001 From: kyu Date: Wed, 3 Jun 2026 19:47:17 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A3=BC=EA=B0=84=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=ED=95=99=EC=8A=B5=20lambda=20async=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(learn=5Fweights/learn=5Fpricing)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 일요일 가중치·가격모델 학습이 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) --- score-engine/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/score-engine/main.py b/score-engine/main.py index 737bf00..7d1650c 100644 --- a/score-engine/main.py +++ b/score-engine/main.py @@ -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)