2023-11-16 05:16:27 +00:00
|
|
|
|
# coding=utf-8
|
|
|
|
|
|
"""
|
|
|
|
|
|
@project: maxkb
|
|
|
|
|
|
@Author:虎
|
|
|
|
|
|
@file: common.py
|
|
|
|
|
|
@date:2023/11/10 10:41
|
|
|
|
|
|
@desc:
|
|
|
|
|
|
"""
|
|
|
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
|
|
|
|
|
|
|
|
work_thread_pool = ThreadPoolExecutor(5)
|
|
|
|
|
|
|
2024-01-29 09:07:07 +00:00
|
|
|
|
embedding_thread_pool = ThreadPoolExecutor(3)
|
|
|
|
|
|
|
2023-11-16 05:16:27 +00:00
|
|
|
|
|
|
|
|
|
|
def poxy(poxy_function):
|
|
|
|
|
|
def inner(args):
|
|
|
|
|
|
work_thread_pool.submit(poxy_function, args)
|
|
|
|
|
|
|
|
|
|
|
|
return inner
|
2024-01-29 09:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def embedding_poxy(poxy_function):
|
|
|
|
|
|
def inner(args):
|
|
|
|
|
|
embedding_thread_pool.submit(poxy_function, args)
|
|
|
|
|
|
|
|
|
|
|
|
return inner
|