2.19 判断是否招标文件
This commit is contained in:
parent
5463a0b0d3
commit
0595a87efa
@ -27,12 +27,17 @@ def judge_zbfile() -> Any: #判断是否是招标文件
|
|||||||
unique_id = g.unique_id
|
unique_id = g.unique_id
|
||||||
result = [None] # 用于存储结果的可变对象
|
result = [None] # 用于存储结果的可变对象
|
||||||
done = threading.Event() # 标志判断是否完成
|
done = threading.Event() # 标志判断是否完成
|
||||||
|
pool = current_app.process_pool # 使用全局的进程池
|
||||||
def judge_zbfile_exec_sub(file_path):
|
def judge_zbfile_exec_sub(file_path):
|
||||||
with multiprocessing.Pool(processes=1) as pool:
|
# with multiprocessing.Pool(processes=1) as pool:
|
||||||
result = pool.apply(
|
# result = pool.apply(
|
||||||
judge_zbfile_exec, # 你的实际执行函数
|
# judge_zbfile_exec, # 你的实际执行函数
|
||||||
args=(file_path,)
|
# args=(file_path,)
|
||||||
)
|
# )
|
||||||
|
result = pool.apply(
|
||||||
|
judge_zbfile_exec, # 你的实际执行函数
|
||||||
|
args=(file_path,)
|
||||||
|
)
|
||||||
return result
|
return result
|
||||||
def wrapper() -> None:
|
def wrapper() -> None:
|
||||||
"""
|
"""
|
||||||
@ -52,7 +57,7 @@ def judge_zbfile() -> Any: #判断是否是招标文件
|
|||||||
logger.info(f"Local file path: {downloaded_filepath}")
|
logger.info(f"Local file path: {downloaded_filepath}")
|
||||||
|
|
||||||
# 调用实际的判断函数
|
# 调用实际的判断函数
|
||||||
judge_result = judge_zbfile_exec(downloaded_filepath)
|
judge_result = judge_zbfile_exec_sub(downloaded_filepath)
|
||||||
judge = JudgeResult.YES if judge_result else JudgeResult.NO
|
judge = JudgeResult.YES if judge_result else JudgeResult.NO
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
|
@ -16,6 +16,7 @@ from flask_app.routes.test_preprocess import test_process_bp
|
|||||||
def create_app():
|
def create_app():
|
||||||
# 创建全局日志记录器
|
# 创建全局日志记录器
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.process_pool = Pool(processes=5, maxtasksperchild=1)
|
||||||
app.global_logger = create_logger_main('model_log') # 全局日志记录器
|
app.global_logger = create_logger_main('model_log') # 全局日志记录器
|
||||||
# 注册蓝图
|
# 注册蓝图
|
||||||
app.register_blueprint(get_deviation_bp)
|
app.register_blueprint(get_deviation_bp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user