Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
funasr_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ab7cab83
authored
Mar 20, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]线程进程日志打印
1 parent
f22caec0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
kafka_service/funasr_consumer.py
kafka_service/funasr_consumer.py
View file @
ab7cab8
import
multiprocessing
import
threading
import
time
import
traceback
...
...
@@ -8,7 +10,6 @@ from log.logger import log
from
mysql.connector
import
pooling
from
config.config
import
ConfigInfo
# 配置 Kafka 消费者
consumer
=
KafkaConsumer
(
ConfigInfo
.
kafka_consumer_analysis_topic
,
...
...
@@ -64,7 +65,7 @@ def consume_kafka():
if
message
is
None
:
continue
log
.
info
(
f
"Received message: {message}"
)
log
.
info
(
f
"Received message value: {message.value}"
)
log
.
info
(
f
"
process name:{multiprocessing.current_process()},thread name:{threading.currentThread()},
Received message value: {message.value}"
)
# 处理逻辑
start_time
=
time
.
time
()
funasr_service
.
handle_process
(
str
(
message
.
value
.
decode
(
'utf-8'
)))
...
...
@@ -75,10 +76,9 @@ def consume_kafka():
traceback
.
print_exc
()
log
.
error
(
"ocr consumer Exception: "
+
str
(
e
))
# 循环消费消息
# for message in consumer:
# log.info(f"Received message: {message.value}")
# if message is None:
# continue
# funasr_service.handle_process(str(message.value.decode('utf-8')))
\ No newline at end of file
# funasr_service.handle_process(str(message.value.decode('utf-8')))
Write
Preview
Markdown
is supported
Attach a file
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 post a comment