12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- from model.DateUtils import DateUtils
- from data_stat_task import *
- from sync_to_ck_task import *
- du = DateUtils()
- from model.DingTalkUtils import DingTalkUtils
- from app.etl.dm.dm_pitcher_daily_overview import dm_pitcher_daily_overview
- yestoday = du.get_n_days(-1)
- today = du.get_n_days(0)
- """凌晨5点跑昨天的数据"""
- def run(ymd):
- try:
- # 公众号元数据
- channel_by_account_daily(ymd)
- channel_info_daily(ymd)
- # 清洗订单表-同步到ck
- ods_order(ymd)
- order_sync_ck(ymd)
- # 公众号维度数据-同步到ck
- dw_daily_channel_cost(ymd)
- dw_order_channel_cost_sync_ck(ymd)
- dw_channel_daily_total(ymd)
- except Exception as e:
- DingTalkUtils.send("数据ETL出错:",'18860455786')
- def run_order_history():
- """当order表跑了历史的数据,要从这历史数据的最早时间跑此任务流"""
- for i in du.getDateLists('2020-01-01',du.get_n_days(0)):
- print(i)
- ods_order(i)
- order_sync_ck(i)
- dw_channel_daily_total(i)
- dw_daily_channel()
- print('ok')
- def run_cost_history():
- "cost 重跑后,跑此任务流"
- for i in du.getDateLists('2019-03-18',du.get_n_days(0)):
- print(i)
- channel_by_account_daily(i)
- channel_info_daily(i)
- dw_daily_channel_cost(i)
- dw_order_channel_cost_sync_ck(i)
- dw_channel_daily_total(i)
- dw_daily_channel()
- import sys
- if __name__ == '__main__':
- if len(sys.argv)==1:
- run(yestoday)
- else:
- for i in du.getDateLists(sys.argv[1],sys.argv[2]):
- run(i)
|