Migrate MLflow backend to PostgreSQL and fix .env loading
- Add python-dotenv loading in main.py so DATABASE_URL is read from .env before db.py module initializes - Add MLFLOW_TRACKING_URI to .env.example pointing to PostgreSQL - Add python-dotenv>=1.0.0 to pyproject.toml dependencies - Initialize MLflow schema in candle_annotator PostgreSQL database MLflow server now starts without filesystem deprecation warnings and with full job execution support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5fb9733bd6
commit
76cb49e908
3 changed files with 6 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
DATABASE_URL=postgresql://pg_user:pg_password@localhost:5432/candle_annotator
|
DATABASE_URL=postgresql://pg_user:pg_password@localhost:5432/candle_annotator
|
||||||
|
MLFLOW_TRACKING_URI=postgresql://pg_user:pg_password@localhost:5432/candle_annotator
|
||||||
# openssl rand -hex 32 add to main .env too
|
# openssl rand -hex 32 add to main .env too
|
||||||
API_KEY=ML_API_KEY
|
API_KEY=ML_API_KEY
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ from typing import Optional, Dict, Any, List
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
# Load .env file before any module that reads environment variables
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv(Path(__file__).parent.parent / ".env")
|
||||||
|
|
||||||
import requests as http_requests
|
import requests as http_requests
|
||||||
|
|
||||||
from fastapi import FastAPI, HTTPException, Header, Depends, Security, status, Response
|
from fastapi import FastAPI, HTTPException, Header, Depends, Security, status, Response
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ dependencies = [
|
||||||
"psycopg2-binary>=2.9.9",
|
"psycopg2-binary>=2.9.9",
|
||||||
"pydantic>=2.5.0",
|
"pydantic>=2.5.0",
|
||||||
"pydantic-settings>=2.1.0",
|
"pydantic-settings>=2.1.0",
|
||||||
|
"python-dotenv>=1.0.0",
|
||||||
"matplotlib>=3.8.2",
|
"matplotlib>=3.8.2",
|
||||||
"seaborn>=0.13.1",
|
"seaborn>=0.13.1",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue