Commit 09037ed3 authored by lixiaofang's avatar lixiaofang

修改tasks

parent 0e5287e9
# -*- coding: UTF-8 -*-
import logging
import traceback
import json
import pymysql
import threading
import random
import datetime
from celery import shared_task
from django.conf import settings
from django.core import serializers
from associate.type_info import get_type_info_map as get_type_info_associate
from trans2es.type_info import get_type_info_map
# from rpc.all import get_rpc_remote_invoker
from libs.es import ESPerform
from libs.cache import redis_client
@shared_task
......@@ -21,7 +13,9 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
logging.info("consume es_type:%s" % str(es_type))
try:
if es_type == "suggest_v1" or es_type == "suggest":
suggest_index_type = ["doctor_tips", "hospital_tips", "itemwiki_tips", "collectwiki_tips",
'brandwiki_tips', "productwiki_tips", 'tag_tips', 'wordrel_tips']
if es_type in suggest_index_type:
pk_list = list(frozenset(pk_list))
type_info_map = get_type_info_map()
type_info = type_info_map[es_type]
......@@ -46,3 +40,5 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
finally:
return es_type,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment