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
1d8e04f3
Commit
1d8e04f3
authored
Jan 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update trans2es
parent
f9b0c153
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+9
-9
contrast_similar.py
trans2es/models/contrast_similar.py
+2
-1
No files found.
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
1d8e04f3
...
...
@@ -12,8 +12,8 @@ import sys
from
libs.es
import
ESPerform
import
trans2es.models
as
md
from
trans2es.utils
import
topic_transfer
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
from
libs.cache
import
redis_client
from
trans2es.models.face_user_contrast_similar
import
FaceUserContrastSimilar
...
...
@@ -84,20 +84,21 @@ class SyncDataToRedis(object):
class
Command
(
BaseCommand
):
args
=
''
help
=
'dump data to elasticsearch, parallel'
from
optparse
import
make_option
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'-t'
,
'--type'
,
dest
=
'type'
,
help
=
'type name to dump data to elasticsearch'
,
metavar
=
'TYPE'
,
default
=
''
),
make_option
(
'-i'
,
'--index-prefix'
,
dest
=
'index_prefix'
,
help
=
'index name to dump data to elasticsearch'
,
metavar
=
'INDEX_PREFIX'
),
make_option
(
'-t'
,
'--type'
,
dest
=
'type'
,
help
=
'type name to dump data to elasticsearch'
,
metavar
=
'TYPE'
,
default
=
''
),
make_option
(
'-i'
,
'--index-prefix'
,
dest
=
'index_prefix'
,
help
=
'index name to dump data to elasticsearch'
,
metavar
=
'INDEX_PREFIX'
),
make_option
(
'-p'
,
'--parallel'
,
dest
=
'parallel'
,
help
=
'parallel process count'
,
metavar
=
'PARALLEL'
),
make_option
(
'-s'
,
'--pks'
,
dest
=
'pks'
,
help
=
'specify sync pks, comma separated'
,
metavar
=
'PKS'
,
default
=
''
),
make_option
(
'--streaming-slicing'
,
dest
=
'streaming_slicing'
,
action
=
'store_true'
,
default
=
True
),
make_option
(
'--no-streaming-slicing'
,
dest
=
'streaming_slicing'
,
action
=
'store_false'
,
default
=
True
),
make_option
(
'-S'
,
'--sync_type'
,
dest
=
'sync_type'
,
help
=
'sync data to es'
,
metavar
=
'TYPE'
,
default
=
''
)
make_option
(
'-S'
,
'--sync_type'
,
dest
=
'sync_type'
,
help
=
'sync data to es'
,
metavar
=
'TYPE'
,
default
=
''
)
)
def
__sync_data_by_type
(
self
,
type_name
):
...
...
@@ -122,12 +123,11 @@ class Command(BaseCommand):
for
type_name
in
type_name_list
:
if
len
(
options
[
"type"
]):
if
options
[
"type"
]
==
"all"
or
type_name
==
options
[
"type"
]:
if
options
[
"type"
]
==
"all"
or
type_name
==
options
[
"type"
]:
logging
.
info
(
"begin sync [
%
s] data to es!"
%
type_name
)
self
.
__sync_data_by_type
(
type_name
)
if
len
(
options
[
"sync_type"
])
and
options
[
"sync_type"
]
==
"sync_data_to_es"
:
if
len
(
options
[
"sync_type"
])
and
options
[
"sync_type"
]
==
"sync_data_to_es"
:
SyncDataToRedis
.
sync_face_similar_data_to_redis
()
except
:
...
...
trans2es/models/contrast_similar.py
View file @
1d8e04f3
...
...
@@ -34,7 +34,8 @@ class ContrastSimilar(models.Model):
try
:
similar_user_id_list
=
list
()
if
cls
.
objects
.
similarity
>
0.3
:
query_list
=
Topic
.
objects
.
filter
(
user_id
=
cls
.
objects
.
participant_user_id
,
is_deleted
=
False
,
is_online
=
True
,
query_list
=
Topic
.
objects
.
filter
(
user_id
=
cls
.
objects
.
participant_user_id
,
is_deleted
=
False
,
is_online
=
True
,
content_level__in
=
(
"3"
,
"4"
,
"5"
))
for
item
in
query_list
:
if
item
.
user_id
!=
cls
.
objects
.
participant_user_id
:
...
...
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