Commit b8f3d428 by ‘chizw’

[+]多进程优化

1 parent e23e0ff8
import multiprocessing import multiprocessing
import threading
import time import time
from funasr import AutoModel from funasr import AutoModel
from log.logger import log from log.logger import log
...@@ -64,6 +65,8 @@ class model_output(): ...@@ -64,6 +65,8 @@ class model_output():
def handle_process(message: str): def handle_process(message: str):
try: try:
log.info(f"""handle_process process name:{multiprocessing.current_process()},thread name:{threading.current_thread().name},
Received task_id: {message}""")
# 处理逻辑 # 处理逻辑
start_time = time.time() start_time = time.time()
task_id = json.loads(message)["task_id"] task_id = json.loads(message)["task_id"]
...@@ -71,7 +74,7 @@ def handle_process(message: str): ...@@ -71,7 +74,7 @@ def handle_process(message: str):
log.info("funasr_handle_process耗时:" + str(time.time() - start_time)) log.info("funasr_handle_process耗时:" + str(time.time() - start_time))
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
log.error("funasr consumer Exception: " + str(e)) log.error("funasr handle_process Exception: " + str(e))
def deal_worker(task_id: str): def deal_worker(task_id: str):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!