import os
import sys
import time

sys.path.append(os.path.dirname(sys.path[0]))

from utils.ssh_util import SSHUtil
from utils.common_util import CommonUtil

if __name__ == '__main__':
    days = [
        # "2022-07-27",
        # "2022-07-28",
        # "2022-07-29",
        # "2022-08-29",
        # "2022-08-30",
        # "2022-09-26",
        # "2022-11-01",
        # "2022-11-28",
        # "2022-12-26",
        "2023-01-30",
        "2023-02-23",
        "2023-02-24",
        "2023-02-25",
        "2023-02-26",
        "2023-02-27",
        "2023-02-28",
        "2023-03-01",
        "2023-03-02",
        "2023-03-03",
        "2023-03-04",
        "2023-03-05",
        "2023-03-06",
        "2023-03-07",
        "2023-03-08",
        "2023-03-09",
        "2023-03-10",
        "2023-03-11",
        "2023-03-12",
        "2023-03-13",
        "2023-03-14",
        "2023-03-15",
        "2023-03-16",
        "2023-03-17",
        "2023-03-18",
        "2023-03-19",
        "2023-03-20",
        "2023-03-21",
        "2023-03-22",
        "2023-03-23",
        "2023-03-24",
        "2023-03-25",
        "2023-03-26",
        "2023-03-27",
        "2023-03-28",
        "2023-03-29",
        "2023-03-30",
        "2023-03-31",
        "2023-04-01",
        "2023-04-02",
        "2023-04-03",
        "2023-04-04",
        "2023-04-05",
        "2023-04-06",
        "2023-04-07",
        "2023-04-08",
        "2023-04-09",
        "2023-04-11",
        "2023-04-13",
        "2023-04-14",
        "2023-04-15",
        "2023-04-16",
        "2023-04-17",
        "2023-04-18",
        "2023-04-19",
        "2023-04-20",
        "2023-04-21",
        "2023-04-22",
        "2023-04-23",
        "2023-04-24",
        "2023-04-25",
        "2023-04-26",
        "2023-04-27",
        "2023-04-28",
        "2023-04-29",
        "2023-04-30",
        "2023-05-01",
        "2023-05-05",
        "2023-05-06",
        "2023-05-08",
        "2023-05-09",
        "2023-05-10",
        "2023-05-11",
        "2023-05-12",
        "2023-05-13",
        "2023-05-14",
        "2023-05-15",
        "2023-05-17",
        "2023-05-18",
        "2023-05-19",
        "2023-05-22",
        "2023-05-23",
        "2023-05-24",
        "2023-05-25",
        "2023-05-26",
    ]
    client = SSHUtil.get_ssh_client()
    for day in days:
        sh = rf"""
    /opt/module/anaconda3/envs/pyspark/bin/python3.8 /opt/module/spark/demo/py_demo/sqoop_export/dwd_bsr_asin_rank.py us  {day}
        """
        SSHUtil.exec_command_async(client, sh, ignore_err=False)
        time.sleep(2)
    pass

CommonUtil.send_wx_msg(['wujicang'], "提醒", "BSR历史数据导出重跑成功!!")