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 baaf74b0
authored
Mar 23, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]参数优化
1 parent
6d177c0c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
16 deletions
funasr_service.py
kafka_service/funasr_consumer.py
main.py
mysql_service/MysqlHelper.py
mysql_service/mysql_utils.py
funasr_service.py
View file @
baaf74b
...
...
@@ -78,8 +78,7 @@ def handle_process(message: str):
deal_worker
(
task_id
)
log
.
info
(
"funasr_handle_process耗时:"
+
str
(
time
.
time
()
-
start_time
))
except
Exception
as
e
:
traceback
.
print_exc
()
log
.
error
(
"funasr handle_process Exception: "
+
str
(
e
))
log
.
error
(
"funasr handle_process Exception: "
+
str
(
traceback
.
format_exc
()))
def
deal_worker
(
task_id
:
str
):
...
...
kafka_service/funasr_consumer.py
View file @
baaf74b
...
...
@@ -38,8 +38,7 @@ class MultiThreadKafka(object):
funasr_service
.
handle_process
(
str
(
message
.
value
.
decode
(
'utf-8'
)))
print
(
"task handle"
)
except
Exception
as
e
:
traceback
.
print_exc
()
log
.
error
(
"funasr consumer Exception: "
+
str
(
e
))
log
.
error
(
"funasr consumer Exception: "
+
str
(
traceback
.
format_exc
()))
def
operate
(
self
):
consumer
=
KafkaConsumer
(
...
...
@@ -88,8 +87,7 @@ def consume_kafka():
# process_pool.close()
# process_pool.join()
except
Exception
as
e
:
traceback
.
print_exc
()
log
.
error
(
"funasr consumer Exception: "
+
str
(
e
))
log
.
error
(
"funasr consumer Exception: "
+
str
(
traceback
.
format_exc
()))
# 循环消费消息
# for message in consumer:
...
...
main.py
View file @
baaf74b
...
...
@@ -214,8 +214,7 @@ async def create_url(param: UrlParam):
log
.
info
(
f
"response:{response}"
)
return
response
except
Exception
as
e
:
log
.
error
(
f
"error:{e}"
)
traceback
.
print_exc
()
log
.
error
(
f
"error:{traceback.format_exc()}"
)
return
BaseResponse
(
code
=-
1
,
msg
=
"error"
,
...
...
mysql_service/MysqlHelper.py
View file @
baaf74b
...
...
@@ -76,8 +76,7 @@ class MysqlHelper:
log
.
info
(
"execute_modify result:
%
s"
%
res
)
result
=
True
except
Exception
as
e
:
log
.
error
(
e
)
traceback
.
print_exc
()
log
.
error
(
traceback
.
format_exc
())
self
.
con
.
rollback
result
=
False
return
result
...
...
@@ -99,8 +98,7 @@ class MysqlHelper:
log
.
info
(
"execute_select result:
%
s"
%
res
)
return
res
except
Exception
as
e
:
log
.
error
(
e
)
traceback
.
print_exc
()
log
.
error
(
traceback
.
format_exc
())
return
False
finally
:
pass
...
...
@@ -116,8 +114,7 @@ class MysqlHelper:
res
=
self
.
cursor
.
fetchone
return
res
except
Exception
as
e
:
log
.
error
(
e
)
traceback
.
print_exc
()
log
.
error
(
traceback
.
format_exc
())
return
False
finally
:
pass
...
...
mysql_service/mysql_utils.py
View file @
baaf74b
...
...
@@ -58,8 +58,7 @@ def select_sql(sql):
log
.
info
(
"execute_select result:
%
s"
%
res
)
return
res
except
Exception
as
msg
:
traceback
.
print_exc
()
log
.
error
(
"sql执行Exception: "
+
str
(
msg
))
log
.
error
(
"sql执行Exception: "
+
str
(
traceback
.
format_exc
()))
finally
:
cursor
.
close
()
conn
.
close
()
...
...
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