优化
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user