优化同步过程中小区变更问题
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"""
|
||||
import logging
|
||||
import pandas as pd
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils, areautils
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils
|
||||
from elasticsearch import helpers
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
@@ -28,8 +28,7 @@ def sync(city=None):
|
||||
seaweed_query = {'cat': 'district', 'status': 0}
|
||||
if pd.notna(city):
|
||||
seaweed_query['city'] = city
|
||||
seaweed_df = pd.DataFrame(
|
||||
list(seaweed_conn.find(seaweed_query, {'city': 1, 'region': 1, 'name': 1, 'alias': 1}).batch_size(100000)))
|
||||
seaweed_df = pd.read_csv('/opt/airflow/dags/repo/dags/business/community/data/seaweed.csv', sep='@', encoding='UTF-8')
|
||||
|
||||
with ThreadPoolExecutor(50) as pool:
|
||||
def deal(index, item):
|
||||
@@ -52,7 +51,6 @@ def sync(city=None):
|
||||
for index, item in seaweed_df.iterrows():
|
||||
pool.submit(deal, index, item)
|
||||
|
||||
seaweed_df['_id'] = seaweed_df['_id'].astype(str)
|
||||
|
||||
actions = list()
|
||||
count = 0
|
||||
|
||||
Reference in New Issue
Block a user