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

37 lines
1.2 KiB
Python
Raw Permalink 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.
"""单独补跑 DWS_ASSISTANT_SALARY设置 allow_out_of_cycle=True 绕过月初限制)
背景:联调时 ETL 运行日期为 2/27day=27 > run_days=5_should_skip_run 返回 True
导致 4 个窗口切片全部跳过ins=0。本脚本设置环境变量后通过 CLI 补跑。
"""
import os, subprocess, sys
from pathlib import Path
from dotenv import load_dotenv
load_dotenv(Path(__file__).resolve().parents[2] / ".env")
# 设置 allow_out_of_cycle 环境变量
os.environ["DWS_SALARY_ALLOW_OUT_OF_CYCLE"] = "1"
# 通过 CLI 运行
cmd = [
sys.executable, "-m", "cli.main",
"--tasks", "DWS_ASSISTANT_SALARY",
"--flow", "dwd_dws",
"--processing-mode", "full_window",
"--window-start", "2025-11-01",
"--window-end", "2026-02-27",
"--window-split", "day",
"--window-split-days", "30",
"--force-full",
]
cwd = Path(__file__).resolve().parents[2] / "apps" / "etl" / "connectors" / "feiqiu"
print(f"工作目录: {cwd}")
print(f"命令: {' '.join(cmd)}")
print(f"DWS_SALARY_ALLOW_OUT_OF_CYCLE={os.environ.get('DWS_SALARY_ALLOW_OUT_OF_CYCLE')}")
print("=" * 60)
result = subprocess.run(cmd, cwd=str(cwd), capture_output=False)
sys.exit(result.returncode)