diff --git a/dags/business/business/community/relative_price_ranking.py b/dags/business/business/community/relative_price_ranking.py index cc2131e..b7f270d 100644 --- a/dags/business/business/community/relative_price_ranking.py +++ b/dags/business/business/community/relative_price_ranking.py @@ -84,7 +84,7 @@ def find_around_price_item(seaweed): return global find_count find_count += 1 - if find_count % 1000 == 0: + if find_count % 1 == 0: log.info("已查找" + str(find_count)) mutex.acquire() @@ -118,7 +118,7 @@ def find_around_price_item(seaweed): } actions.append(action) - if len(actions) == 1000: + if len(actions) == 10: helpers.bulk(es206_client.elastic_client, actions) log.info("更新:" + str(find_count)) actions.clear() @@ -128,20 +128,20 @@ def find_around_price_item(seaweed): def sync(city=None): log.info("开始同步相对价格排名数据...") - tmp_sql = f"select * from community_summary " + tmp_sql = f"select * from community_summary where avg_price > 0 " if pd.notna(city): - tmp_sql += f" where city='{city}'" + tmp_sql += f" and city='{city}'" seaweed_df = tmp_ck.read_sql_query(tmp_sql) seaweed_list = list() seaweed_df.apply(lambda x: seaweed_list.append(dict(x)), axis=1) - with ThreadPoolExecutor(max_workers=30) as pool: - for seaweed in seaweed_list: - pool.submit(find_around_price_item, seaweed) + # with ThreadPoolExecutor(max_workers=30) as pool: + # for seaweed in seaweed_list: + # pool.submit(find_around_price_item, seaweed) - # for seaweed in seaweed_list: - # find_around_price_item(seaweed) + for seaweed in seaweed_list: + find_around_price_item(seaweed) if len(actions) > 0: helpers.bulk(es206_client.elastic_client, actions)