From 499837510adcbba27665fd48b3eb3ac135d6c48f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 19 三月 2025 14:28:18 +0800 Subject: [PATCH] 并行框架修改 --- l2/l2_transaction_data_processor.py | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/l2/l2_transaction_data_processor.py b/l2/l2_transaction_data_processor.py index 8f5a96a..d91c60a 100644 --- a/l2/l2_transaction_data_processor.py +++ b/l2/l2_transaction_data_processor.py @@ -104,11 +104,17 @@ return temp_data limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) - # 骞惰澶勭悊涔板崟涓庡崠鍗� - f1 = statistic_big_buy_data() - f2 = statistic_big_sell_data() - dask_result = statistic_big_data(f1, f2) - buy_datas, sell_datas = dask_result.compute() + + if len(fdatas) > 100: + # 骞惰澶勭悊涔板崟涓庡崠鍗� + # 瓒呰繃100鏉℃暟鎹墠闇�瑕佸苟琛屽鐞� + f1 = dask.delayed(statistic_big_buy_data)() + f2 = dask.delayed(statistic_big_sell_data)() + dask_result = dask.delayed(statistic_big_data)(f1, f2) + buy_datas, sell_datas = dask_result.compute() + else: + buy_datas = statistic_big_buy_data() + sell_datas = statistic_big_sell_data() # L鎾ょ殑姣斾緥涓庝拱鍗栧ぇ鍗曟棤鐩存帴鍏崇郴浜� # if buy_datas or sell_datas: # buy_money = BigOrderDealManager().get_total_buy_money(code) @@ -344,7 +350,7 @@ # =====鏍煎紡鍖栨暟鎹�===== # 鏁村舰鏁版嵁锛屾牸寮忥細[(鏁版嵁鏈韩, 鏄惁涓诲姩涔�, 鏄惁娑ㄥ仠, 鎬绘垚浜ら, 涓嶅惈ms鏃堕棿锛屽惈ms鏃堕棿)] use_time_list = [] - __start_time = int(time.time()*1000) + __start_time = int(time.time() * 1000) fdatas = [ [d, d[6] > d[7], limit_up_price == d[1], d[1] * d[2], '', ''] for d in o_datas] @@ -356,7 +362,7 @@ d[4] = d[5][:8] temp_time_dict.clear() _start_time = int(time.time() * 1000) - use_time_list.append((_start_time - __start_time , "鏁版嵁鏁村舰")) + use_time_list.append((_start_time - __start_time, "鏁版嵁鏁村舰")) try: @@ -423,4 +429,4 @@ _start_time = int(time.time() * 1000) if _start_time - __start_time > 5: l2_log.info(code, hx_logger_l2_upload, - f"{code}澶勭悊鎴愪氦鐢ㄦ椂锛歿_start_time - __start_time} 鏁版嵁鏁伴噺锛歿len(fdatas)} 璇︽儏:{use_time_list}") \ No newline at end of file + f"{code}澶勭悊鎴愪氦鐢ㄦ椂锛歿_start_time - __start_time} 鏁版嵁鏁伴噺锛歿len(fdatas)} 璇︽儏:{use_time_list}") -- Gitblit v1.8.0