调试
This commit is contained in:
@@ -68,28 +68,6 @@ def build_doc(item):
|
|||||||
return doc_dict
|
return doc_dict
|
||||||
|
|
||||||
|
|
||||||
def update_status(new_df):
|
|
||||||
actions = list()
|
|
||||||
|
|
||||||
def deal(item):
|
|
||||||
action_doc = {
|
|
||||||
"_op_type": "update",
|
|
||||||
"_index": "bd_poi",
|
|
||||||
"_id": item['_id'],
|
|
||||||
"doc": {'status': 0}
|
|
||||||
}
|
|
||||||
actions.append(action_doc)
|
|
||||||
if len(actions) == 5000:
|
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
|
||||||
actions.clear()
|
|
||||||
return item
|
|
||||||
|
|
||||||
new_df.apply(lambda x: deal(x), axis=1)
|
|
||||||
if len(actions) > 0:
|
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
|
||||||
actions.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def sync(city=None):
|
def sync(city=None):
|
||||||
log.info("开始同步消费数据...")
|
log.info("开始同步消费数据...")
|
||||||
# 【过期,无需状态】
|
# 【过期,无需状态】
|
||||||
@@ -130,7 +108,10 @@ def sync(city=None):
|
|||||||
print(lng)
|
print(lng)
|
||||||
print(lat)
|
print(lat)
|
||||||
print(price)
|
print(price)
|
||||||
|
print(index)
|
||||||
seaweed_df.loc[index, 'avg_cost'] = price
|
seaweed_df.loc[index, 'avg_cost'] = price
|
||||||
|
if item['_id'] == '50bd172ae4b0fbe60a6fe628':
|
||||||
|
print(seaweed_df.loc[index])
|
||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
for index, item in seaweed_df.iterrows():
|
for index, item in seaweed_df.iterrows():
|
||||||
pool.submit(find_around_price_item, index, item)
|
pool.submit(find_around_price_item, index, item)
|
||||||
@@ -139,6 +120,8 @@ def sync(city=None):
|
|||||||
actions = list()
|
actions = list()
|
||||||
count = 0
|
count = 0
|
||||||
for index, item in seaweed_df.iterrows():
|
for index, item in seaweed_df.iterrows():
|
||||||
|
if item['_id'] == '50bd172ae4b0fbe60a6fe628':
|
||||||
|
print(item)
|
||||||
doc_info = build_doc(item)
|
doc_info = build_doc(item)
|
||||||
|
|
||||||
action = {
|
action = {
|
||||||
|
|||||||
Reference in New Issue
Block a user