This commit is contained in:
shenjian@fangjia.com
2023-05-10 16:54:14 +08:00
parent 6cfd477e30
commit 8760b4d513
@@ -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()