在前后端开发联调前 的提交20260223

This commit is contained in:
Neo
2026-02-23 23:02:20 +08:00
parent 254ccb1e77
commit fafc95e64c
1142 changed files with 10366960 additions and 36957 deletions

View File

@@ -9,6 +9,7 @@ from typing import Any, Iterable, Tuple
from zoneinfo import ZoneInfo
import json
import os
from quality.integrity_checker import IntegrityWindow, compute_last_etl_end, run_integrity_history, run_integrity_window
from scripts.repair.backfill_missing_data import run_backfill
@@ -249,9 +250,16 @@ def run_history_flow(
def write_report(report: dict, *, prefix: str, tz: ZoneInfo, report_path: Path | None = None) -> str:
if report_path is None:
root = Path(__file__).resolve().parents[1]
# 从 .env 读取 ETL_REPORT_ROOT必须配置
env_root = os.environ.get("ETL_REPORT_ROOT")
if not env_root:
raise KeyError(
"环境变量 ETL_REPORT_ROOT 未定义。"
"请在根 .env 中配置,参考 .env.template 和 docs/deployment/EXPORT-PATHS.md"
)
root_dir = Path(env_root)
stamp = datetime.now(tz).strftime("%Y%m%d_%H%M%S")
report_path = root / "reports" / f"{prefix}_{stamp}.json"
report_path = root_dir / f"{prefix}_{stamp}.json"
report_path.parent.mkdir(parents=True, exist_ok=True)
report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
return str(report_path)