sage_datamart/scripts/load_path.py
yumoqing 8a97ea4a86 refactor: rename sage_datamark → sage_datamart + add ETL cron + stat UIs
- Rename package directory and all references from sage_datamark to sage_datamart
- Add 3 ETL cron dspy files (sync/aggregate/provider_cost) for scheduled data pipelines
- Add 5 stat UI files (total_users/fail_calls/success_rate/avg_ttft/total_calls)
- Register j2_ template functions in init.py for UI rendering
- Move j2_avg_ttft SQL to dashboards.py for DRY
- Clean unused imports (getConfig/DBPools/exception)
- Update git remote to sage_datamart.git
2026-07-20 10:49:15 +08:00

31 lines
833 B
Python

#!/usr/bin/env python3
"""sage_datamart 模块 load_path"""
import os, sys, subprocess
MOD = "sage_datamart"
SAGE_ROOT = os.environ.get("SAGE_ROOT", os.path.expanduser("~/sage"))
PYTHON = os.path.join(SAGE_ROOT, "py3", "bin", "python")
SET_PERM = os.path.join(SAGE_ROOT, "set_role_perm.py")
PATHS_LOGINED = [
f"/{MOD}",
f"/{MOD}/index.ui",
f"/{MOD}/provider_roi.ui",
f"/{MOD}/menu.ui",
f"/{MOD}/stat_avg_ttft.ui",
f"/{MOD}/stat_success_rate.ui",
f"/{MOD}/stat_total_calls.ui",
f"/{MOD}/stat_fail_calls.ui",
f"/{MOD}/stat_today_usage.ui",
f"/{MOD}/stat_today_amount.ui",
f"/{MOD}/api/%",
]
def run(role, path):
subprocess.run([PYTHON, SET_PERM, role, path], capture_output=True)
for p in PATHS_LOGINED:
run("logined", p)
print(f"[{MOD}] {len(PATHS_LOGINED)} paths registered")