"""Detection Model Registry feature flag. 신·구 prediction 경로를 공존시키는 동안 환경변수로 토글한다. 초기 배포에서는 **0 (구 경로 유지)** 가 기본 — Phase 2 PoC 이 신·구 diff=0 동치성을 확인한 뒤 1 로 전환하는 별도 릴리즈를 내는 전략. 환경변수: PREDICTION_USE_MODEL_REGISTRY '1' 이면 DAGExecutor 기반 신 경로 사용 PREDICTION_CONCURRENT_SHADOWS '1' 이면 SHADOW/CHALLENGER 를 스레드풀 동시 실행 (기본 0 — 순차 실행, psycopg2 pool 안전) """ from __future__ import annotations import os def _bool_env(key: str, default: str = '0') -> bool: raw = os.getenv(key, default).strip().lower() return raw in ('1', 'true', 'yes', 'on') def use_model_registry() -> bool: """models_core Registry·Executor 기반 경로 사용 여부.""" return _bool_env('PREDICTION_USE_MODEL_REGISTRY', '0') def concurrent_shadows() -> bool: """SHADOW/CHALLENGER 를 ThreadPoolExecutor 로 동시 실행할지.""" return _bool_env('PREDICTION_CONCURRENT_SHADOWS', '0')