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 e5dd166d
authored
Mar 20, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]增加消费者进程数
1 parent
be491f34
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
main.py
main.py
View file @
e5dd166
import
argparse
import
argparse
import
multiprocessing
import
traceback
import
traceback
from
kafka_service
import
funasr_producer
from
kafka_service
import
funasr_producer
import
os
import
os
...
@@ -192,9 +193,6 @@ async def create_url(param: UrlParam):
...
@@ -192,9 +193,6 @@ async def create_url(param: UrlParam):
data
=
"数据库异常"
data
=
"数据库异常"
)
)
funasr_producer
.
send_message_analysis
({
"task_id"
:
task_id
})
funasr_producer
.
send_message_analysis
({
"task_id"
:
task_id
})
# process = multiprocessing.Process(target=funasr_service.deal_worker, args=(url, task_id,))
# log.info(f"process:{process}")
# process.start()
response
=
BaseResponse
(
response
=
BaseResponse
(
code
=
200
,
code
=
200
,
msg
=
"success"
,
msg
=
"success"
,
...
@@ -213,11 +211,19 @@ def start_kafka():
...
@@ -213,11 +211,19 @@ def start_kafka():
kafka_thread
.
daemon
=
True
# 将线程设置为守护线程,当主线程结束时,该线程也会自动结束
kafka_thread
.
daemon
=
True
# 将线程设置为守护线程,当主线程结束时,该线程也会自动结束
kafka_thread
.
start
()
kafka_thread
.
start
()
def
start_process
():
process
=
multiprocessing
.
Process
(
target
=
funasr_consumer
.
consume_kafka
,)
log
.
info
(
f
"process:{process}"
)
process
.
start
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
log
.
info
(
"funasr main starting..."
)
log
.
info
(
"funasr main starting..."
)
start_kafka
()
start_kafka
()
start_kafka
()
start_process
()
# process = multiprocessing.Process(target=funasr_service.deal_worker, args=(url, task_id,))
# log.info(f"process:{process}")
# process.start()
funasr_producer
.
send_wait_task
()
funasr_producer
.
send_wait_task
()
save_path
=
"./audio/"
save_path
=
"./audio/"
if
os
.
path
.
exists
(
save_path
):
if
os
.
path
.
exists
(
save_path
):
...
...
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