From c3d3d695333fdc9b334416e6a6672a8e06009b24 Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Fri, 28 Oct 2022 19:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/community/relative_price_ranking.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dags/business/business/community/relative_price_ranking.py b/dags/business/business/community/relative_price_ranking.py index d6842a9..ff1dc63 100644 --- a/dags/business/business/community/relative_price_ranking.py +++ b/dags/business/business/community/relative_price_ranking.py @@ -55,12 +55,17 @@ def build_doc(item): return doc_dict -def sync(): +def sync(city=None): log.info("开始同步相对价格排名数据...") seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8') + if pd.notna(city): + seaweed_df = seaweed_df[seaweed_df['city'] == city].copy() + seaweed_df = seaweed_df.reset_index() def find_around_price_item(index, item): + if index % 1000 == 0: + log.info("已处理" + str(index)) if 'lng' not in item: return lng = commutils.format_lat_lng(item['lng']) @@ -73,7 +78,7 @@ def sync(): elif len(around_seaweed_df) == 1: seaweed_df.loc[index, 'relative_price_ranking'] = 0.5 - with ThreadPoolExecutor(max_workers=50) as pool: + with ThreadPoolExecutor(max_workers=30) as pool: for index, item in seaweed_df.iterrows(): pool.submit(find_around_price_item, index, item)