- 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
13 lines
427 B
Plaintext
13 lines
427 B
Plaintext
# ETL: 每天聚合供应商性价比 dm_provider_cost_daily
|
|
ip = request['client_ip']
|
|
if ip not in ['127.0.0.1']:
|
|
return ip
|
|
|
|
import json
|
|
from sage_datamart.etl import ensure_tables, aggregate_provider_cost
|
|
env = request._run_ns
|
|
async with get_sor_context(env, 'sage_datamart') as sor:
|
|
await ensure_tables(sor)
|
|
count = await aggregate_provider_cost(sor)
|
|
return json.dumps({'status': 'ok', 'aggregated': count})
|