Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
李延哲
saturn
Commits
df168cb1
Commit
df168cb1
authored
Jul 18, 2019
by
李延哲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
0de7aa72
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
8 additions
and
4 deletions
+8
-4
heras_transfer.py
data_transfer/heras_transfer.py
+0
-0
data_monitor.py
engine/data_monitor.py
+1
-0
es_base.py
engine/es_base.py
+1
-1
redis_base.py
engine/redis_base.py
+1
-0
track_error.py
engine/track_error.py
+2
-0
tasks.py
hera/tasks.py
+1
-1
mapping.py
settings/mapping.py
+1
-1
settings_local.py
settings/settings_local.py
+1
-1
No files found.
engine
/heras_transfer.py
→
data_transfer
/heras_transfer.py
View file @
df168cb1
File moved
engine/data_monitor.py
View file @
df168cb1
...
@@ -45,6 +45,7 @@ def listen_data():
...
@@ -45,6 +45,7 @@ def listen_data():
continue
continue
#Todo同步到数据库
#Todo同步到数据库
print
(
json
.
dumps
(
event
))
print
(
json
.
dumps
(
event
))
_PoolMinx
.
update_last_record
(
int
(
event
.
get
(
"time"
,
0
)))
table_index
[
event
.
get
(
"table"
)]
.
handle_data
(
event
)
table_index
[
event
.
get
(
"table"
)]
.
handle_data
(
event
)
# LazyDataHandle.handle_data()
# LazyDataHandle.handle_data()
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
...
...
engine/es_base.py
View file @
df168cb1
import
json
import
json
from
elasticsearch
import
Elasticsearch
,
helpers
from
elasticsearch
import
Elasticsearch
,
helpers
from
django.conf
import
settings
from
django.conf
import
settings
from
engine.track_error
import
track_handle
ES_HOSTS
=
[
'127.0.0.1:9200'
]
ES_HOSTS
=
[
'127.0.0.1:9200'
]
...
@@ -21,7 +22,6 @@ class ESPerform(object):
...
@@ -21,7 +22,6 @@ class ESPerform(object):
except
:
except
:
return
None
return
None
@classmethod
@classmethod
def
lazy_batch
(
cls
,
body
,
index
,
doc_type
):
def
lazy_batch
(
cls
,
body
,
index
,
doc_type
):
"""批量处理 包括增删改"""
"""批量处理 包括增删改"""
...
...
engine/redis_base.py
View file @
df168cb1
...
@@ -29,6 +29,7 @@ class _PoolMinx(object):
...
@@ -29,6 +29,7 @@ class _PoolMinx(object):
class
LazyRecord
(
_PoolMinx
):
class
LazyRecord
(
_PoolMinx
):
def
__init__
(
self
,
model_name
):
def
__init__
(
self
,
model_name
):
self
.
prefix
=
"lazydata__"
self
.
prefix
=
"lazydata__"
self
.
_index
=
model_name
self
.
_index
=
model_name
...
...
engine/track_error.py
0 → 100644
View file @
df168cb1
def
track_handle
():
pass
hera/tasks.py
View file @
df168cb1
...
@@ -16,6 +16,6 @@ def data_sync():
...
@@ -16,6 +16,6 @@ def data_sync():
lazy_cli
=
LazyRecord
(
model_name
=
lazy_key
)
lazy_cli
=
LazyRecord
(
model_name
=
lazy_key
)
lazy_data
=
lazy_cli
.
pop_data
(
pop_count
=
settings
.
LazyLen
)
lazy_data
=
lazy_cli
.
pop_data
(
pop_count
=
settings
.
LazyLen
)
try
:
try
:
ESPerform
.
lazy_
create
(
lazy_data
)
ESPerform
.
lazy_
batch
(
lazy_data
)
except
:
except
:
lazy_cli
.
push_data
(
lazy_data
)
lazy_cli
.
push_data
(
lazy_data
)
settings/mapping.py
View file @
df168cb1
#ES映射到具体的Mysql
#ES映射到具体的Mysql
from
engine
.heras_transfer
import
LocalDemo
from
data_transfer
.heras_transfer
import
LocalDemo
table_index
=
{
table_index
=
{
"runoob_tbl"
:
LocalDemo
"runoob_tbl"
:
LocalDemo
...
...
settings/settings_local.py
View file @
df168cb1
...
@@ -10,7 +10,7 @@ ES_HOSTS = ['127.0.0.1']
...
@@ -10,7 +10,7 @@ ES_HOSTS = ['127.0.0.1']
REDIS
=
{
REDIS
=
{
'default'
:
{
'host'
:
'127.0.0.1'
,
'port'
:
6379
,
'db'
:
0
},
'default'
:
{
'host'
:
'127.0.0.1'
,
'port'
:
6379
,
'db'
:
0
},
'es_lazydata'
:
{
'host'
:
'127.0.0.1'
,
'port'
:
6379
,
'db'
:
1
}
'es_lazydata'
:
{
'host'
:
'127.0.0.1'
,
'port'
:
6379
,
'db'
:
1
}
,
}
}
LazyLen
=
100
LazyLen
=
100
...
...
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