I am running an API back and currently, I am using a subprocess.Popen
. As the called modules are pure python my idea is to run it with multiprocessing.Process
or Pull
. The request is processed like this:
Connexion
endpointWhen replacing:
Popen(...)
with
p = Process(target=...)
p.start()
this happens to multiprocessing with uwsgi:
Connexion
endpointin if I run it on https://github.com/tiangolo/uwsgi-nginx-flask-docker :
...
It works as espected if I run the process with python -m...
.
My uwsgi.ini looks like this
[uwsgi]
module = myapp
callable = app
lazy-apps = true
stats-http = true
http = 127.0.0.1:8080
Your uwsgi.ini should enable threads, which are by default, blocked.
Change it to the following
[uwsgi]
module = myapp
callable = app
lazy-apps = true
stats-http = true
http = 127.0.0.1:8080
enable-threads = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.