INNER CODE UNIT · Python
_ensure_startup_directories
skygazer42/MimirQ · app/main.py:233
def _ensure_startup_directories() -> None:
for dir_path in _iter_startup_directories():
_ensure_directory(dir_path, warning_prefix="Failed to ensure directory")
def _ensure_parent_directory(path_value: object, *, warning_message: str) -> None:
try:
Path(str(path_value)).parent.mkdir(parents=True, exist_ok=True)
except Exception as exc: # noqa: BLE001
logger.warning("%s: %s", warning_message, str(exc)[:200])
def _ensure_optional_log_directories() -> None:
if bool(getattr(settings, "ENABLE_METRICS_LOG", False)):
_ensure_parent_directory(
getattr(settings, "METRICS_LOG_PATH", "./logs/rag_metrics.jsonl"),
warning_message="Failed to ensure metrics log dir",
)