新增公交测试
This commit is contained in:
@@ -22,6 +22,7 @@ mutex = Lock()
|
||||
def deal(actions, item):
|
||||
global count
|
||||
curr_city = item['city']
|
||||
log.info(curr_city)
|
||||
lng = commutils.format_lat_lng(item['lng'])
|
||||
lat = commutils.format_lat_lng(item['lat'])
|
||||
|
||||
@@ -31,6 +32,7 @@ def deal(actions, item):
|
||||
doc_info = dict()
|
||||
# 公交
|
||||
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:
|
||||
doc_info['bus_station'] = ",".join(bus_station)
|
||||
@@ -81,9 +83,11 @@ 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)
|
||||
# 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)
|
||||
if len(actions) > 0:
|
||||
helpers.bulk(es206_client.elastic_client, actions)
|
||||
actions.clear()
|
||||
|
||||
Reference in New Issue
Block a user