开启进程
This commit is contained in:
parent
2ebc066892
commit
14e21d9faf
@ -10,6 +10,8 @@
|
|||||||
import json
|
import json
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from multiprocessing import Process
|
||||||
|
|
||||||
|
|
||||||
from flask import Blueprint, request
|
from flask import Blueprint, request
|
||||||
|
|
||||||
@ -45,7 +47,8 @@ def start_train_algorithm():
|
|||||||
def wrapped_function():
|
def wrapped_function():
|
||||||
param = request.args.get('param')
|
param = request.args.get('param')
|
||||||
id = request.args.get('id')
|
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)
|
set_value(key=id, value=False)
|
||||||
t.start()
|
t.start()
|
||||||
return output_wrapped(0, 'success', '成功')
|
return output_wrapped(0, 'success', '成功')
|
||||||
|
Loading…
Reference in New Issue
Block a user