Files
Neo-ZQYY/scripts/ops/resubmit_v4.py

65 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""第四次执行:验证 BUG 4dim_member/dim_member_card_account site_id 修复)。"""
from __future__ import annotations
import json
import sys
from pathlib import Path
import requests
BASE = "http://localhost:8000"
TOKEN_FILE = Path(__file__).parent / ".monitor_token"
REFRESH_TOKEN = (
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."
"eyJzdWIiOiIxIiwic2l0ZV9pZCI6Mjc5MDY4NTQxNTQ0MzI2OSwidHlwZSI6InJlZnJlc2giLCJleHAiOjE3NzIyNjM0NjN9."
"XYoda5lfxNtTSAGWoLlYhS9cA-hTK9iqK0SqUyn2KV4"
)
# 刷新 token
resp = requests.post(f"{BASE}/api/auth/refresh", json={"refresh_token": REFRESH_TOKEN}, timeout=10)
if resp.status_code != 200:
print(f"❌ 刷新失败: {resp.status_code} {resp.text}")
sys.exit(1)
token = resp.json()["access_token"]
TOKEN_FILE.write_text(token, encoding="utf-8")
print("✅ token 已刷新")
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
config = {
"tasks": [
"DWS_ASSISTANT_DAILY", "DWS_ASSISTANT_MONTHLY", "DWS_ASSISTANT_CUSTOMER",
"DWS_ASSISTANT_SALARY", "DWS_ASSISTANT_FINANCE",
"ODS_SETTLEMENT_RECORDS", "ODS_PAYMENT", "ODS_REFUND",
"DWS_BUILD_ORDER_SUMMARY", "DWS_MEMBER_CONSUMPTION", "DWS_MEMBER_VISIT",
"ODS_GOODS_CATEGORY", "ODS_STORE_GOODS", "ODS_STORE_GOODS_SALES",
"ODS_TENANT_GOODS", "ODS_PLATFORM_COUPON", "ODS_GROUP_PACKAGE",
"ODS_GROUP_BUY_REDEMPTION", "ODS_INVENTORY_STOCK", "ODS_INVENTORY_CHANGE",
"DWS_GOODS_STOCK_DAILY", "DWS_GOODS_STOCK_WEEKLY", "DWS_GOODS_STOCK_MONTHLY",
"DWS_FINANCE_DAILY", "DWS_FINANCE_RECHARGE", "DWS_FINANCE_INCOME_STRUCTURE",
"DWS_FINANCE_DISCOUNT_DETAIL", "DWS_WINBACK_INDEX", "DWS_NEWCONV_INDEX",
"DWS_RELATION_INDEX", "DWD_LOAD_FROM_ODS",
],
"flow": "api_full",
"processing_mode": "full_window",
"window_mode": "custom",
"window_start": "2025-11-01",
"window_end": "2026-02-20",
"window_split": "month",
"window_split_days": 30,
"force_full": True,
"dry_run": False,
"lookback_hours": 24,
"overlap_seconds": 600,
}
r = requests.post(f"{BASE}/api/execution/run", headers=headers, json=config, timeout=30)
if r.status_code == 200:
data = r.json()
eid = data.get("execution_id", data.get("id", "?"))
print(f"✅ 提交成功: execution_id={eid}")
else:
print(f"❌ 提交失败: {r.status_code} {r.text}")
sys.exit(1)