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
87c3e0d3
Commit
87c3e0d3
authored
Nov 22, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
cea5c194
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
14 deletions
+11
-14
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+1
-4
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+2
-2
topic.json
trans2es/mapping/topic.json
+0
-0
topic.py
trans2es/models/topic.py
+1
-1
type_info.py
trans2es/type_info.py
+5
-5
topic_transfer.py
trans2es/utils/topic_transfer.py
+2
-2
No files found.
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
87c3e0d3
...
...
@@ -11,7 +11,7 @@ import sys
from
libs.es
import
ESPerform
import
trans2es.models
as
md
from
trans2es.utils
import
diary
_transfer
from
trans2es.utils
import
topic
_transfer
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
...
...
@@ -60,9 +60,6 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
try
:
#get_data_func = diary_transfer.DiaryTransfer
#query_set = django.db.models.QuerySet(model=md.Diary,query=md.Diary.objects.all().query)
type_name_list
=
get_type_info_map
()
.
keys
()
for
type_name
in
type_name_list
:
...
...
trans2es/management/commands/trans2es_mapping2es.py
View file @
87c3e0d3
...
...
@@ -15,7 +15,7 @@ class Command(BaseCommand):
es_obj
=
ESPerform
()
es_cli
=
es_obj
.
get_cli
()
es_obj
.
create_index
(
es_cli
,
"
diary
"
)
es_obj
.
put_index_mapping
(
es_cli
,
"diary
"
)
es_obj
.
create_index
(
es_cli
,
"
topic
"
)
es_obj
.
put_index_mapping
(
es_cli
=
es_cli
,
sub_index_name
=
"topic
"
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
trans2es/mapping/
diary
.json
→
trans2es/mapping/
topic
.json
View file @
87c3e0d3
File moved
trans2es/models/
diary
.py
→
trans2es/models/
topic
.py
View file @
87c3e0d3
...
...
@@ -8,7 +8,7 @@ import logging
from
libs.es
import
ESPerform
from
django.db
import
models
class
Diary
(
models
.
Model
):
class
Topic
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'日记'
verbose_name_plural
=
u'日记'
...
...
trans2es/type_info.py
View file @
87c3e0d3
...
...
@@ -12,8 +12,8 @@ import elasticsearch
import
elasticsearch.helpers
import
sys
from
trans2es.models
import
diary
from
trans2es.utils.
diary_transfer
import
Diary
Transfer
from
trans2es.models
import
topic
from
trans2es.utils.
topic_transfer
import
Topic
Transfer
from
libs.es
import
ESPerform
...
...
@@ -236,9 +236,9 @@ def get_type_info_map():
TypeInfo
(
name
=
'topic'
,
# 日记
type
=
'topic'
,
model
=
diary
.
Diary
,
query_deferred
=
lambda
:
diary
.
Diary
.
objects
.
all
()
.
query
,
get_data_func
=
DiaryTransfer
.
get_diary
_data
,
model
=
topic
.
Topic
,
query_deferred
=
lambda
:
topic
.
Topic
.
objects
.
all
()
.
query
,
get_data_func
=
TopicTransfer
.
get_topic
_data
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_period
=
2
,
...
...
trans2es/utils/
diary
_transfer.py
→
trans2es/utils/
topic
_transfer.py
View file @
87c3e0d3
...
...
@@ -5,13 +5,13 @@ import sys
import
logging
import
traceback
class
Diary
Transfer
(
object
):
class
Topic
Transfer
(
object
):
def
__init__
(
self
):
pass
@classmethod
def
get_
diary
_data
(
cls
,
instance
):
def
get_
topic
_data
(
cls
,
instance
):
try
:
res
=
dict
()
...
...
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