fix: call init_db() on ML service startup to create training_runs table
This commit is contained in:
parent
d5fc4662e9
commit
b4956f3fb9
1 changed files with 4 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ import mlflow.xgboost
|
||||||
from sqlalchemy import update as sa_update, desc
|
from sqlalchemy import update as sa_update, desc
|
||||||
|
|
||||||
from app.config import load_config, PipelineConfig, get_default_config
|
from app.config import load_config, PipelineConfig, get_default_config
|
||||||
from app.db import get_db, TrainingRun
|
from app.db import get_db, TrainingRun, init_db
|
||||||
from app.preprocessing import preprocess_candles, extract_feature_columns
|
from app.preprocessing import preprocess_candles, extract_feature_columns
|
||||||
from app.patterns import (
|
from app.patterns import (
|
||||||
TALIB_PATTERNS,
|
TALIB_PATTERNS,
|
||||||
|
|
@ -311,6 +311,9 @@ async def startup_event():
|
||||||
"""
|
"""
|
||||||
logger.info("Starting inference service...")
|
logger.info("Starting inference service...")
|
||||||
|
|
||||||
|
# Ensure training_runs table exists
|
||||||
|
init_db()
|
||||||
|
|
||||||
# Mark any stale "running" records as failed — they belong to a previous
|
# Mark any stale "running" records as failed — they belong to a previous
|
||||||
# process and will never complete.
|
# process and will never complete.
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue