修复BUG
This commit is contained in:
@@ -11,7 +11,8 @@ from threading import Lock
|
|||||||
|
|
||||||
mutex = Lock()
|
mutex = Lock()
|
||||||
log = logging.getLogger(__name__)
|
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')
|
tmp_ck = ClickHouseClient(database='tmp')
|
||||||
|
|
||||||
index_name = "community_summary"
|
index_name = "community_summary"
|
||||||
@@ -114,7 +115,7 @@ def sync(city=None):
|
|||||||
log.info("开始同步消费数据...")
|
log.info("开始同步消费数据...")
|
||||||
tmp_sql = f"select * from community_summary "
|
tmp_sql = f"select * from community_summary "
|
||||||
if pd.notna(city):
|
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_df = tmp_ck.read_sql_query(tmp_sql)
|
||||||
|
|
||||||
seaweed_list = list()
|
seaweed_list = list()
|
||||||
@@ -143,12 +144,12 @@ def sync(city=None):
|
|||||||
|
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
if len(actions) == 5000:
|
if len(actions) == 5000:
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
helpers.bulk(es89_client.elastic_client, actions)
|
||||||
count += len(actions)
|
count += len(actions)
|
||||||
log.info("更新:" + str(count))
|
log.info("更新:" + str(count))
|
||||||
actions.clear()
|
actions.clear()
|
||||||
if len(actions) > 0:
|
if len(actions) > 0:
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
helpers.bulk(es89_client.elastic_client, actions)
|
||||||
actions.clear()
|
actions.clear()
|
||||||
|
|
||||||
log.info("完成同步消费数据...")
|
log.info("完成同步消费数据...")
|
||||||
|
|||||||
Reference in New Issue
Block a user