公交代码还原
This commit is contained in:
@@ -31,22 +31,14 @@ def deal(actions, item):
|
||||
|
||||
doc_info = dict()
|
||||
# 公交
|
||||
log.info("查找公交站")
|
||||
bus_station = poiutils.find_around_by_location(curr_city, 1000, [lng, lat], "交通", "公交")
|
||||
log.info(bus_station)
|
||||
doc_info['bus_station_num'] = len(bus_station)
|
||||
if len(bus_station) > 0:
|
||||
log.info("写入公交站")
|
||||
doc_info['bus_station'] = ",".join(bus_station)
|
||||
log.info("写入公交站完毕")
|
||||
log.info("查找最近公交站")
|
||||
bus_doc = poiutils.find_nearest_by_location(curr_city, None, [lng, lat], "交通", "公交")
|
||||
log.info("查找最近公交站完毕")
|
||||
if pd.notna(bus_doc):
|
||||
log.info("写入最近公交站")
|
||||
doc_info['nearest_bus_station_distance'] = int(bus_doc['sort'][0])
|
||||
doc_info['nearest_bus_station'] = bus_doc['_source']['name']
|
||||
log.info("写入最近公交站完毕")
|
||||
|
||||
# 地铁
|
||||
subway_station = poiutils.find_around_by_location(curr_city, 1000, [lng, lat], "交通", "地铁")
|
||||
@@ -85,11 +77,9 @@ def sync(city=None):
|
||||
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||
|
||||
actions = list()
|
||||
# with ThreadPoolExecutor(max_workers=30) as pool:
|
||||
# for index, item in seaweed_df.iterrows():
|
||||
# pool.submit(deal, actions, item)
|
||||
for index, item in seaweed_df.iterrows():
|
||||
deal(actions, item)
|
||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||
for index, item in seaweed_df.iterrows():
|
||||
pool.submit(deal, actions, item)
|
||||
if len(actions) > 0:
|
||||
helpers.bulk(es206_client.elastic_client, actions)
|
||||
actions.clear()
|
||||
|
||||
Reference in New Issue
Block a user