From 15453e103c5397432bb7116659903975aecece4a Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Tue, 14 Mar 2023 17:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/comm.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dags/business/business/community/comm.py b/dags/business/business/community/comm.py index 9fb3d99..c98b037 100644 --- a/dags/business/business/community/comm.py +++ b/dags/business/business/community/comm.py @@ -1,10 +1,10 @@ """ 同步小区基本信息至ES206 """ -import sys -sys.path.insert(0, '/opt/airflow/dags/repo') -import dags.install as install -install.install() +# import sys +# sys.path.insert(0, '/opt/airflow/dags/repo') +# import dags.install as install +# install.install() import logging import pandas as pd @@ -132,6 +132,11 @@ def sync(city=None): count += len(actions) log.info("更新:" + str(count)) actions.clear() + if len(actions) > 0: + helpers.bulk(es206_client.elastic_client, actions) + count += len(actions) + log.info("更新:" + str(count)) + actions.clear() # 对于不存在的插入 count = 0 @@ -153,6 +158,8 @@ def sync(city=None): actions.clear() if len(actions) > 0: helpers.bulk(es206_client.elastic_client, actions) + count += len(actions) + log.info("插入:" + str(count)) actions.clear() # 写入csv文件,防止小区变动导致的后续过程更新报错