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
alpha
physical
Commits
26a03a72
Commit
26a03a72
authored
Sep 03, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'db_name' into 'master'
slave See merge request
!460
parents
4323008d
84128d3d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
type_info.py
trans2es/type_info.py
+15
-15
No files found.
trans2es/type_info.py
View file @
26a03a72
...
@@ -13,7 +13,7 @@ import elasticsearch.helpers
...
@@ -13,7 +13,7 @@ import elasticsearch.helpers
import
sys
import
sys
from
libs.cache
import
redis_client
from
libs.cache
import
redis_client
import
copy
import
copy
from
django.conf
import
settings
from
trans2es.models
import
topic
,
user
,
pick_celebrity
,
group
,
celebrity
,
tag
,
contrast_similar
,
pictorial
,
product
from
trans2es.models
import
topic
,
user
,
pick_celebrity
,
group
,
celebrity
,
tag
,
contrast_similar
,
pictorial
,
product
from
trans2es.utils.user_transfer
import
UserTransfer
from
trans2es.utils.user_transfer
import
UserTransfer
from
trans2es.utils.pick_celebrity_transfer
import
PickCelebrityTransfer
from
trans2es.utils.pick_celebrity_transfer
import
PickCelebrityTransfer
...
@@ -315,7 +315,7 @@ def get_type_info_map():
...
@@ -315,7 +315,7 @@ def get_type_info_map():
name
=
'topic-star'
,
name
=
'topic-star'
,
type
=
'topic-star'
,
type
=
'topic-star'
,
model
=
topic
.
Topic
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
# 假的
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
# 假的
get_data_func
=
TopicTransfer
.
get_topic_data
,
# 假的
get_data_func
=
TopicTransfer
.
get_topic_data
,
# 假的
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -325,7 +325,7 @@ def get_type_info_map():
...
@@ -325,7 +325,7 @@ def get_type_info_map():
name
=
'topic-star-routing'
,
name
=
'topic-star-routing'
,
type
=
'topic-star-routing'
,
type
=
'topic-star-routing'
,
model
=
topic
.
Topic
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -335,7 +335,7 @@ def get_type_info_map():
...
@@ -335,7 +335,7 @@ def get_type_info_map():
name
=
'topic-high-star'
,
# >=4星日记
name
=
'topic-high-star'
,
# >=4星日记
type
=
'topic-high-star'
,
type
=
'topic-high-star'
,
model
=
topic
.
Topic
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -345,7 +345,7 @@ def get_type_info_map():
...
@@ -345,7 +345,7 @@ def get_type_info_map():
name
=
'excellect-topic'
,
# 优质帖子
name
=
'excellect-topic'
,
# 优质帖子
type
=
'excellect-topic'
,
type
=
'excellect-topic'
,
model
=
topic
.
ExcellentTopic
,
model
=
topic
.
ExcellentTopic
,
query_deferred
=
lambda
:
topic
.
ExcellentTopic
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
topic
.
ExcellentTopic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
ExcellectTopicTransfer
.
get_excellect_topic_data
,
get_data_func
=
ExcellectTopicTransfer
.
get_excellect_topic_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -355,7 +355,7 @@ def get_type_info_map():
...
@@ -355,7 +355,7 @@ def get_type_info_map():
name
=
'topic'
,
# 日记
name
=
'topic'
,
# 日记
type
=
'topic'
,
type
=
'topic'
,
model
=
topic
.
Topic
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -365,7 +365,7 @@ def get_type_info_map():
...
@@ -365,7 +365,7 @@ def get_type_info_map():
name
=
'topic-v1'
,
# 日记
name
=
'topic-v1'
,
# 日记
type
=
'topic-v1'
,
type
=
'topic-v1'
,
model
=
topic
.
Topic
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
get_data_func
=
TopicTransfer
.
get_topic_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -377,7 +377,7 @@ def get_type_info_map():
...
@@ -377,7 +377,7 @@ def get_type_info_map():
model
=
user
.
User
,
model
=
user
.
User
,
# query_deferred=lambda:user.User.objects.all().query,
# query_deferred=lambda:user.User.objects.all().query,
# query_deferred=lambda: user.User.objects.prefetch_related('myuserfollow').query,
# query_deferred=lambda: user.User.objects.prefetch_related('myuserfollow').query,
query_deferred
=
lambda
:
user
.
User
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
user
.
User
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
UserTransfer
.
get_user_data
,
get_data_func
=
UserTransfer
.
get_user_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -399,7 +399,7 @@ def get_type_info_map():
...
@@ -399,7 +399,7 @@ def get_type_info_map():
type
=
"celebrity"
,
type
=
"celebrity"
,
model
=
celebrity
.
Celebrity
,
model
=
celebrity
.
Celebrity
,
# query_deferred=lambda:user.User.objects.all().query,
# query_deferred=lambda:user.User.objects.all().query,
query_deferred
=
lambda
:
celebrity
.
Celebrity
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
celebrity
.
Celebrity
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
CelebrityTransfer
.
get_celebrity_data
,
get_data_func
=
CelebrityTransfer
.
get_celebrity_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -410,7 +410,7 @@ def get_type_info_map():
...
@@ -410,7 +410,7 @@ def get_type_info_map():
type
=
"group"
,
type
=
"group"
,
model
=
group
.
Group
,
model
=
group
.
Group
,
# query_deferred=lambda:user.User.objects.all().query,
# query_deferred=lambda:user.User.objects.all().query,
query_deferred
=
lambda
:
group
.
Group
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
group
.
Group
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
GroupTransfer
.
get_group_data
,
get_data_func
=
GroupTransfer
.
get_group_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -420,7 +420,7 @@ def get_type_info_map():
...
@@ -420,7 +420,7 @@ def get_type_info_map():
name
=
"tag"
,
# 标签
name
=
"tag"
,
# 标签
type
=
"tag"
,
type
=
"tag"
,
model
=
tag
.
Tag
,
model
=
tag
.
Tag
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TagTransfer
.
get_tag_data
,
get_data_func
=
TagTransfer
.
get_tag_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -430,7 +430,7 @@ def get_type_info_map():
...
@@ -430,7 +430,7 @@ def get_type_info_map():
name
=
"tag_v1"
,
# 标签
name
=
"tag_v1"
,
# 标签
type
=
"tag_v1"
,
type
=
"tag_v1"
,
model
=
tag
.
Tag
,
model
=
tag
.
Tag
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TagTransfer
.
get_tag_data
,
get_data_func
=
TagTransfer
.
get_tag_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -440,7 +440,7 @@ def get_type_info_map():
...
@@ -440,7 +440,7 @@ def get_type_info_map():
name
=
"tag-name"
,
# 标签名字
name
=
"tag-name"
,
# 标签名字
type
=
"tag-name"
,
type
=
"tag-name"
,
model
=
tag
.
Tag
,
model
=
tag
.
Tag
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
TagTransfer
.
get_tag_name_data
,
get_data_func
=
TagTransfer
.
get_tag_name_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -450,7 +450,7 @@ def get_type_info_map():
...
@@ -450,7 +450,7 @@ def get_type_info_map():
name
=
'contrast_similar'
,
# facesimilar
name
=
'contrast_similar'
,
# facesimilar
type
=
'contrast_similar'
,
type
=
'contrast_similar'
,
model
=
contrast_similar
.
ContrastSimilar
,
model
=
contrast_similar
.
ContrastSimilar
,
query_deferred
=
lambda
:
contrast_similar
.
ContrastSimilar
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
contrast_similar
.
ContrastSimilar
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
Contrast_Similar_Transfer
.
get_contrast_similar_data
,
get_data_func
=
Contrast_Similar_Transfer
.
get_contrast_similar_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
@@ -460,7 +460,7 @@ def get_type_info_map():
...
@@ -460,7 +460,7 @@ def get_type_info_map():
name
=
"pictorial"
,
# 画报
name
=
"pictorial"
,
# 画报
type
=
"pictorial"
,
type
=
"pictorial"
,
model
=
pictorial
.
Pictorial
,
model
=
pictorial
.
Pictorial
,
query_deferred
=
lambda
:
pictorial
.
Pictorial
.
objects
.
all
()
.
query
,
query_deferred
=
lambda
:
pictorial
.
Pictorial
.
objects
.
using
(
settings
.
SLAVE2_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
PictorialTransfer
.
get_poctorial_data
,
get_data_func
=
PictorialTransfer
.
get_poctorial_data
,
bulk_insert_chunk_size
=
100
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
...
...
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