ck 3 vuotta sitten
vanhempi
commit
a7192c68a0

+ 1 - 1
app/api_data/get_cost_older.py

@@ -117,7 +117,7 @@ def get_daily_qq(st,et):
 	print("获取qq账号:",token_list_q.__len__())
 	time1 = time.time()
 	li=[]
-	executor = ThreadPoolExecutor(max_workers=10)
+	executor = ThreadPoolExecutor(max_workers=5)
 	for x in token_list_q:
 
 		executor.submit(get_q_data,x,li,st,et)

+ 1 - 1
app/api_data/platform_order/yuewen.py

@@ -53,7 +53,7 @@ def get_yuewen_order_task(st, et, account):
         params['sign'] = sign
         # print(params)
         response_result_json = requests.get(url=url, params=params).json()
-        print(response_result_json)
+        # print(response_result_json)
 
         # print(len(response_result_json["data"]["list"]))
 

+ 3 - 2
app/dailyRun.py

@@ -3,6 +3,7 @@ from app.etl import data_stat_run
 from model.DateUtils import DateUtils
 from app.api_data import get_cost
 from app.etl.dw import dw_image_cost_day
+from app import task
 du = DateUtils()
 
 
@@ -10,8 +11,8 @@ du = DateUtils()
 
 if __name__ == '__main__':
 
-    # 订单数据
-    get_order.daily()
+    # 订单数据和消耗数据
+    task.daily()
 
     # 数据处理
     data_stat_run.daily()

+ 1 - 1
app/hourlyRun.py

@@ -23,7 +23,7 @@ if __name__ == '__main__':
     get_cost.hourly()  # 广告相关消耗数据
     dw_image_cost_day.hourly()
 
-    # DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="18860455786")
+    DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="18860455786")
 
 
 

+ 71 - 31
app/task.py

@@ -1,35 +1,75 @@
 
-from multiprocessing import Process
+import threading
 from app.api_data.get_order import *
 from app.api_data.get_cost_older import old_cost_hourly
+
 def hourly():
-    p1 = Process(target=huasheng)
-    p2 = Process(target=qiyue)
-    p3 = Process(target=qiyueyousheng)
-    p4 = Process(target=wending)
-    p5 = Process(target=zhangdu)
-    p6 = Process(target=zhangzhongyun)
-    p7 = Process(target=yueweng)
-    p8 = Process(target=youshuge)
-    p9 = Process(target=yangguang)
-    p10 = Process(target=old_cost_hourly)
-    p1.start()
-    p1.join()
-    p2.start()
-    p2.join()
-    p3.start()
-    p3.join()
-    p4.start()
-    p4.join()
-    p5.start()
-    p5.join()
-    p6.start()
-    p6.join()
-    p7.start()
-    p7.join()
-    p8.start()
-    p8.join()
-    p9.start()
-    p9.join()
-    p10.start()
-    p10.join()
+    t1 = threading.Thread(target=huasheng)
+    t2 = threading.Thread(target=qiyue)
+    t3 = threading.Thread(target=qiyueyousheng)
+    t4 = threading.Thread(target=wending)
+    t5 = threading.Thread(target=zhangdu)
+    t6 = threading.Thread(target=zhangzhongyun)
+    t7 = threading.Thread(target=yueweng)
+    t8 = threading.Thread(target=yangguang)
+    t9 = threading.Thread(target=youshuge)
+    t10 = threading.Thread(target=old_cost_hourly)
+    t1.start()
+    t1.join()
+    t2.start()
+    t2.join()
+    t3.start()
+    t3.join()
+    t4.start()
+    t4.join()
+    t5.start()
+    t5.join()
+    t6.start()
+    t6.join()
+    t7.start()
+    t7.join()
+    t8.start()
+    t8.join()
+    t9.start()
+    t9.join()
+    t10.start()
+    t10.join()
+
+
+def daily():
+    st = du.get_n_days(-10)
+    et = du.get_n_days(-1)
+
+    t1 = threading.Thread(target=huasheng,args=(st,et))
+    t2 = threading.Thread(target=qiyue,args=(st,et))
+    t3 = threading.Thread(target=qiyueyousheng,args=(st,et))
+    t4 = threading.Thread(target=wending,args=(st,et))
+    t5 = threading.Thread(target=zhangdu,args=(st,et))
+    t6 = threading.Thread(target=zhangzhongyun,args=(st,et))
+    t7 = threading.Thread(target=yueweng,args=(st,et))
+    t8 = threading.Thread(target=yangguang,args=(st,et))
+    t9 = threading.Thread(target=youshuge,args=(st,et))
+    t10 = threading.Thread(target=old_cost_hourly,args=(st,et))
+    t1.start()
+    t1.join()
+    t2.start()
+    t2.join()
+    t3.start()
+    t3.join()
+    t4.start()
+    t4.join()
+    t5.start()
+    t5.join()
+    t6.start()
+    t6.join()
+    t7.start()
+    t7.join()
+    t8.start()
+    t8.join()
+    t9.start()
+    t9.join()
+    t10.start()
+    t10.join()
+
+if __name__ == '__main__':
+    hourly()

+ 0 - 1
model/DingTalkUtils.py

@@ -43,7 +43,6 @@ from functools import wraps
 # 钉钉报警装饰器
 def DingTalkDecorators(msg):
     def wrapper(func):
-        @wraps(func)
         def deco(*args, **kwargs):
             try:
                 func(*args, **kwargs)