From db8cbf0edb8e991706695ad03739298493d450c1 Mon Sep 17 00:00:00 2001 From: sjshenjian Date: Wed, 27 Nov 2024 16:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/avg_cost.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dags/business/business/community/avg_cost.py b/dags/business/business/community/avg_cost.py index 73fa72e..3fe7bae 100644 --- a/dags/business/business/community/avg_cost.py +++ b/dags/business/business/community/avg_cost.py @@ -11,7 +11,8 @@ from threading import Lock mutex = Lock() log = logging.getLogger(__name__) -es206_client = ElasticSearchClient(host='192.168.0.89', username='elastic', password='elasticsearch') +es206_client = ElasticSearchClient(host='192.168.0.206') +es89_client = ElasticSearchClient(host='192.168.0.89', username='elastic', password='elasticsearch') tmp_ck = ClickHouseClient(database='tmp') index_name = "community_summary" @@ -114,7 +115,7 @@ def sync(city=None): log.info("开始同步消费数据...") tmp_sql = f"select * from community_summary " if pd.notna(city): - tmp_sql += f" where city='{city}'" + tmp_sql += f" where city='{city}' " seaweed_df = tmp_ck.read_sql_query(tmp_sql) seaweed_list = list() @@ -143,12 +144,12 @@ def sync(city=None): actions.append(action) if len(actions) == 5000: - helpers.bulk(es206_client.elastic_client, actions) + helpers.bulk(es89_client.elastic_client, actions) count += len(actions) log.info("更新:" + str(count)) actions.clear() if len(actions) > 0: - helpers.bulk(es206_client.elastic_client, actions) + helpers.bulk(es89_client.elastic_client, actions) actions.clear() log.info("完成同步消费数据...")