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
251baa05
Commit
251baa05
authored
Mar 12, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'similar_sort' into 'master'
modify See merge request
alpha/physical!162
parents
a3516dc3
fe34b457
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
collect_data.py
linucb/views/collect_data.py
+7
-3
No files found.
linucb/views/collect_data.py
View file @
251baa05
...
@@ -20,8 +20,8 @@ class KafkaManager(object):
...
@@ -20,8 +20,8 @@ class KafkaManager(object):
if
not
cls
.
consumser_obj
:
if
not
cls
.
consumser_obj
:
topic_name
=
cls
.
topic_name
if
not
topic_name
else
topic_name
topic_name
=
cls
.
topic_name
if
not
topic_name
else
topic_name
cls
.
consumser_obj
=
KafkaConsumer
(
bootstrap_servers
=
cls
.
kafka_broker_list
)
cls
.
consumser_obj
=
KafkaConsumer
(
topic_name
,
bootstrap_servers
=
cls
.
kafka_broker_list
)
cls
.
consumser_obj
.
subscribe
([
topic_name
])
#
cls.consumser_obj.subscribe([topic_name])
return
cls
.
consumser_obj
return
cls
.
consumser_obj
...
@@ -82,7 +82,11 @@ class CollectData(object):
...
@@ -82,7 +82,11 @@ class CollectData(object):
user_feature
=
[
1
,
1
]
user_feature
=
[
1
,
1
]
kafka_consumer_obj
=
KafkaManager
.
get_kafka_consumer_ins
(
topic_name
)
kafka_consumer_obj
=
KafkaManager
.
get_kafka_consumer_ins
(
topic_name
)
for
ori_msg
in
kafka_consumer_obj
:
while
True
:
msg_dict
=
kafka_consumer_obj
.
poll
(
timeout_ms
=
100
)
for
msg_key
in
msg_dict
:
consume_msg
=
msg_dict
[
msg_key
]
for
ori_msg
in
consume_msg
:
try
:
try
:
logging
.
info
(
ori_msg
)
logging
.
info
(
ori_msg
)
...
...
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