2.19 判断是否招标文件

This commit is contained in:
zy123 2025-02-19 16:17:33 +08:00
parent 5463a0b0d3
commit 0595a87efa
2 changed files with 12 additions and 6 deletions

View File

@ -27,12 +27,17 @@ def judge_zbfile() -> Any: #判断是否是招标文件
unique_id = g.unique_id
result = [None] # 用于存储结果的可变对象
done = threading.Event() # 标志判断是否完成
pool = current_app.process_pool # 使用全局的进程池
def judge_zbfile_exec_sub(file_path):
with multiprocessing.Pool(processes=1) as pool:
result = pool.apply(
judge_zbfile_exec, # 你的实际执行函数
args=(file_path,)
)
# with multiprocessing.Pool(processes=1) as pool:
# result = pool.apply(
# judge_zbfile_exec, # 你的实际执行函数
# args=(file_path,)
# )
result = pool.apply(
judge_zbfile_exec, # 你的实际执行函数
args=(file_path,)
)
return result
def wrapper() -> None:
"""
@ -52,7 +57,7 @@ def judge_zbfile() -> Any: #判断是否是招标文件
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
end_time = time.time()

View File

@ -16,6 +16,7 @@ from flask_app.routes.test_preprocess import test_process_bp
def create_app():
# 创建全局日志记录器
app = Flask(__name__)
app.process_pool = Pool(processes=5, maxtasksperchild=1)
app.global_logger = create_logger_main('model_log') # 全局日志记录器
# 注册蓝图
app.register_blueprint(get_deviation_bp)