解决线上日志不输出问题

This commit is contained in:
Jian Shen
2022-06-18 15:11:54 +08:00
parent 2254f2fa67
commit 56a92bb6c6
+7 -4
View File
@@ -1,11 +1,13 @@
"""
小区周边1公里银行入库业务逻辑
"""
import logging
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient
import pandas as pd
from pymongo import UpdateOne
log = logging.getLogger(__name__)
elastic_client = ElasticSearchClient(host='192.168.0.206')
district_facilitys_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'district_facilitys')
seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed')
@@ -24,6 +26,7 @@ bank_typecode = ["160100", "160101", "160102", "160103", "160104", "160105", "16
"160144",
"160145", "160146", "160147", "160148", "160149", "160150", "160151", "160152", "160200"]
log.info("开始执行周边银行配套入库")
def find_around_by_location(city, location):
"""
@@ -81,7 +84,7 @@ def deal(city, lng, lat):
for city_item in city_dict:
city = city_item['display']
print('开始查找' + city + '周边银行')
log.info('开始查找' + city + '周边银行')
seaweed_df = pd.DataFrame(list(seaweed_conn.find({'city': city, 'cat': 'district', 'status': 0},
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(
10000)))
@@ -90,7 +93,7 @@ for city_item in city_dict:
seaweed_df['bank'] = seaweed_df.apply(lambda x: deal(x['city'], x['lng'], x['lat']), axis=1)
actions = list()
print(city + '周边银行开始入库')
log.info(city + '周边银行开始入库')
for index, item in seaweed_df.iterrows():
try:
# 周边配套库中历史原因,id可能不为小区id
@@ -106,4 +109,4 @@ for city_item in city_dict:
if len(actions) > 0:
district_facilitys_conn.bulk_write(actions)
actions.clear()
print(city + '周边银行入库完毕')
log.info(city + '周边银行入库完毕')