import os
import sys
import datetime as dt
import pandas as pd
import time

sys.path.append(os.path.dirname(sys.path[0]))  # 上级目录
from utils.DolphinschedulerHelper import DolphinschedulerHelper


if __name__ == '__main__':
    site_name = sys.argv[1]  # 参数1：站点
    date_type = sys.argv[2]  # 参数2：类型：week/4_week/month/quarter
    date_info = sys.argv[3]  # 参数3：年-周/年-月/年-季, 比如: 2022-1
    process_df_name = f"aba主题匹配工作流-月度-api"
    DolphinschedulerHelper.start_process_instance(
        project_name="big_data_selection",
        process_df_name=process_df_name,
        startParams={
            "site_name": site_name,
            "date_type": date_type,
            "date_info": date_info
        },
        warning_Type="ALL"
    )
    print(f"【{site_name}】站点，流程【{process_df_name}】启动成功！")