优化
This commit is contained in:
@@ -82,12 +82,12 @@ def find_around_price_item(seaweed):
|
|||||||
# 某些经纬度根本不在该城市下,数据问题
|
# 某些经纬度根本不在该城市下,数据问题
|
||||||
if len(around_seaweed_df) == 0:
|
if len(around_seaweed_df) == 0:
|
||||||
return
|
return
|
||||||
mutex.acquire(timeout=300)
|
|
||||||
global find_count
|
global find_count
|
||||||
find_count += 1
|
find_count += 1
|
||||||
if find_count % 1000 == 0:
|
if find_count % 1000 == 0:
|
||||||
log.info("已查找" + str(find_count))
|
log.info("已查找" + str(find_count))
|
||||||
|
|
||||||
|
mutex.acquire()
|
||||||
if len(around_seaweed_df) > 1:
|
if len(around_seaweed_df) > 1:
|
||||||
around_seaweed_df['relative_price_ranking'] = around_seaweed_df['avg_price'].rank(pct=True)
|
around_seaweed_df['relative_price_ranking'] = around_seaweed_df['avg_price'].rank(pct=True)
|
||||||
seaweed['relative_price_ranking'] = around_seaweed_df[around_seaweed_df['id'] == seaweed['_id']].iloc[0][
|
seaweed['relative_price_ranking'] = around_seaweed_df[around_seaweed_df['id'] == seaweed['_id']].iloc[0][
|
||||||
@@ -118,7 +118,7 @@ def find_around_price_item(seaweed):
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
if len(actions) == 5000:
|
if len(actions) == 1000:
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
helpers.bulk(es206_client.elastic_client, actions)
|
||||||
log.info("更新:" + str(find_count))
|
log.info("更新:" + str(find_count))
|
||||||
actions.clear()
|
actions.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user