Commit f3d6ae58 authored by 段英荣's avatar 段英荣

modify

parent 2e427512
......@@ -171,18 +171,35 @@ class TypeInfo(object):
)
def insert_table_by_pk_list(self, sub_index_name, pk_list, es=None, use_batch_query_set=False):
begin = time.time()
if use_batch_query_set:
qs = self.queryset
else:
qs = self.model.objects.all()
end = time.time()
time0=end-begin
begin = time.time()
instance_list = qs.filter(pk__in=pk_list)
end = time.time()
time1=end-begin
begin = time.time()
data_list = self.bulk_get_data(instance_list)
end = time.time()
time2=end-begin
begin = time.time()
self.elasticsearch_bulk_insert_data(
sub_index_name=sub_index_name,
data_list=data_list,
es=es,
)
end = time.time()
time3=end-begin
logging.info("duan add,insert_table_by_pk_list time cost:%ds,%ds,%ds,%ds" % (time0,time1,time2,time3))
def insert_table_chunk(self, sub_index_name, table_chunk, es=None):
try:
......
......@@ -34,36 +34,36 @@ class TopicTransfer(object):
res["group_id"] = -1
res["share_num"] = instance.share_num
begin = datetime.datetime.now()
begin = time.time()
res["pick_id_list"] = instance.get_pick_id_info()
end = datetime.datetime.now()
time0 = (end-begin).seconds
end = time.time()
time0 = (end-begin)
begin = datetime.datetime.now()
begin = time.time()
(topic_tag_id_list, edit_tag_id_list) = instance.get_topic_tag_id_list()
res["tag_list"] = topic_tag_id_list
res["edit_tag_list"] = edit_tag_id_list
end = datetime.datetime.now()
time1 = (end-begin).seconds
end = time.time()
time1 = (end-begin)
begin = datetime.datetime.now()
begin = time.time()
res["tag_name_list"] = instance.get_tag_name_list(res["tag_list"])
end = datetime.datetime.now()
time2 = (end-begin).seconds
end = time.time()
time2 = (end-begin)
begin = datetime.datetime.now()
begin = time.time()
res["offline_score"] = instance.get_topic_offline_score()
end = datetime.datetime.now()
time3 = (end-begin).seconds
end = time.time()
time3 = (end-begin)
begin = datetime.datetime.now()
begin = time.time()
res["manual_score"] = instance.drop_score
res["has_image"] = instance.topic_has_image()
res["has_video"] = instance.has_video
res["language_type"] = instance.language_type
end = datetime.datetime.now()
time4 = (end-begin).seconds
end = time.time()
time4 = (end-begin)
# # 片假名
# re_jp_pian_words = re.compile(u"[\u30a0-\u30ff]+")
......
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