# ================================================================ # TRAINING SERVICE CONFIGURATION # services/training/app/core/config.py # ================================================================ """ Training service configuration ML model training and management """ from shared.config.base import BaseServiceSettings import os class TrainingSettings(BaseServiceSettings): """Training service specific settings""" # Service Identity APP_NAME: str = "Training Service" SERVICE_NAME: str = "training-service" DESCRIPTION: str = "Machine learning model training service" # Database Configuration DATABASE_URL: str = os.getenv("TRAINING_DATABASE_URL", "postgresql+asyncpg://training_user:training_pass123@training-db:5432/training_db") # Redis Database (dedicated for training cache) REDIS_DB: int = 1 # ML Model Storage MODEL_STORAGE_PATH: str = os.getenv("MODEL_STORAGE_PATH", "/app/models") MODEL_BACKUP_ENABLED: bool = os.getenv("MODEL_BACKUP_ENABLED", "true").lower() == "true" MODEL_VERSIONING_ENABLED: bool = os.getenv("MODEL_VERSIONING_ENABLED", "true").lower() == "true" # Training Configuration MAX_TRAINING_TIME_MINUTES: int = int(os.getenv("MAX_TRAINING_TIME_MINUTES", "30")) MAX_CONCURRENT_TRAINING_JOBS: int = int(os.getenv("MAX_CONCURRENT_TRAINING_JOBS", "3")) MIN_TRAINING_DATA_DAYS: int = int(os.getenv("MIN_TRAINING_DATA_DAYS", "30")) TRAINING_BATCH_SIZE: int = int(os.getenv("TRAINING_BATCH_SIZE", "1000")) # Prophet Specific Configuration PROPHET_SEASONALITY_MODE: str = os.getenv("PROPHET_SEASONALITY_MODE", "additive") PROPHET_CHANGEPOINT_PRIOR_SCALE: float = float(os.getenv("PROPHET_CHANGEPOINT_PRIOR_SCALE", "0.05")) PROPHET_SEASONALITY_PRIOR_SCALE: float = float(os.getenv("PROPHET_SEASONALITY_PRIOR_SCALE", "10.0")) PROPHET_HOLIDAYS_PRIOR_SCALE: float = float(os.getenv("PROPHET_HOLIDAYS_PRIOR_SCALE", "10.0")) # Spanish Holiday Integration ENABLE_SPANISH_HOLIDAYS: bool = True ENABLE_MADRID_HOLIDAYS: bool = True ENABLE_CUSTOM_HOLIDAYS: bool = os.getenv("ENABLE_CUSTOM_HOLIDAYS", "true").lower() == "true" # Data Processing DATA_PREPROCESSING_ENABLED: bool = True OUTLIER_DETECTION_ENABLED: bool = os.getenv("OUTLIER_DETECTION_ENABLED", "true").lower() == "true" SEASONAL_DECOMPOSITION_ENABLED: bool = os.getenv("SEASONAL_DECOMPOSITION_ENABLED", "true").lower() == "true" # Model Validation CROSS_VALIDATION_ENABLED: bool = os.getenv("CROSS_VALIDATION_ENABLED", "true").lower() == "true" VALIDATION_SPLIT_RATIO: float = float(os.getenv("VALIDATION_SPLIT_RATIO", "0.2")) MIN_MODEL_ACCURACY: float = float(os.getenv("MIN_MODEL_ACCURACY", "0.7")) # Distributed Training (for future scaling) DISTRIBUTED_TRAINING_ENABLED: bool = os.getenv("DISTRIBUTED_TRAINING_ENABLED", "false").lower() == "true" TRAINING_WORKER_COUNT: int = int(os.getenv("TRAINING_WORKER_COUNT", "1")) settings = TrainingSettings()