From 14e21d9faf3858ccfd7468f3589941a33e651b2d Mon Sep 17 00:00:00 2001 From: JIAKUNHAO Date: Thu, 24 Nov 2022 09:35:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AF=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/AlgorithmController.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controller/AlgorithmController.py b/app/controller/AlgorithmController.py index 1c5853d..dcfa92a 100644 --- a/app/controller/AlgorithmController.py +++ b/app/controller/AlgorithmController.py @@ -10,6 +10,8 @@ import json from functools import wraps from threading import Thread +from multiprocessing import Process + from flask import Blueprint, request @@ -45,7 +47,8 @@ def start_train_algorithm(): def wrapped_function(): param = request.args.get('param') id = request.args.get('id') - t = Thread(target=func, args=(param, id)) + # t = Thread(target=func, args=(param, id)) + t = Process(target=func, args=(param, id), name=id) set_value(key=id, value=False) t.start() return output_wrapped(0, 'success', '成功')