新增公交测试
This commit is contained in:
@@ -22,6 +22,7 @@ mutex = Lock()
|
|||||||
def deal(actions, item):
|
def deal(actions, item):
|
||||||
global count
|
global count
|
||||||
curr_city = item['city']
|
curr_city = item['city']
|
||||||
|
log.info(curr_city)
|
||||||
lng = commutils.format_lat_lng(item['lng'])
|
lng = commutils.format_lat_lng(item['lng'])
|
||||||
lat = commutils.format_lat_lng(item['lat'])
|
lat = commutils.format_lat_lng(item['lat'])
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ def deal(actions, item):
|
|||||||
doc_info = dict()
|
doc_info = dict()
|
||||||
# 公交
|
# 公交
|
||||||
bus_station = poiutils.find_around_by_location(curr_city, 1000, [lng, lat], "交通", "公交")
|
bus_station = poiutils.find_around_by_location(curr_city, 1000, [lng, lat], "交通", "公交")
|
||||||
|
log.info(bus_station)
|
||||||
doc_info['bus_station_num'] = len(bus_station)
|
doc_info['bus_station_num'] = len(bus_station)
|
||||||
if len(bus_station) > 0:
|
if len(bus_station) > 0:
|
||||||
doc_info['bus_station'] = ",".join(bus_station)
|
doc_info['bus_station'] = ",".join(bus_station)
|
||||||
@@ -81,9 +83,11 @@ def sync(city=None):
|
|||||||
seaweed_df = seaweed_df.reset_index(drop=True)
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
|
|
||||||
actions = list()
|
actions = list()
|
||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
# with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
for index, item in seaweed_df.iterrows():
|
# for index, item in seaweed_df.iterrows():
|
||||||
pool.submit(deal, actions, item)
|
# pool.submit(deal, actions, item)
|
||||||
|
for index, item in seaweed_df.iterrows():
|
||||||
|
deal(actions, item)
|
||||||
if len(actions) > 0:
|
if len(actions) > 0:
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
helpers.bulk(es206_client.elastic_client, actions)
|
||||||
actions.clear()
|
actions.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user