Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
physical
Commits
f3d6ae58
Commit
f3d6ae58
authored
Mar 11, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
2e427512
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
type_info.py
trans2es/type_info.py
+17
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+15
-15
No files found.
trans2es/type_info.py
View file @
f3d6ae58
...
...
@@ -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
:
...
...
trans2es/utils/topic_transfer.py
View file @
f3d6ae58
...
...
@@ -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]+")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment