![](/img/trans.png)
[英]Unexpected output when running tqdm inside multiprocessing.Process
[英]multiprocessing.Process is blocking the return statement when running with uWSGI
我正在运行 API ,目前,我正在使用subprocess.Popen
。 由于被调用的模块是纯 python 我的想法是使用multiprocessing.Process
或Pull
运行它。 请求是这样处理的:
Connexion
端点更换时:
Popen(...)
和
p = Process(target=...)
p.start()
这发生在使用uwsgi 的多处理中:
Connexion
端点如果我在https://github.com/tiangolo/uwsgi-nginx-flask-docker上运行它:
...
如果我使用python -m...
运行该过程,它会按预期工作。
我的 uwsgi.ini 看起来像这样
[uwsgi]
module = myapp
callable = app
lazy-apps = true
stats-http = true
http = 127.0.0.1:8080
您的 uwsgi.ini 应该启用默认情况下被阻止的线程。
将其更改为以下
[uwsgi]
module = myapp
callable = app
lazy-apps = true
stats-http = true
http = 127.0.0.1:8080
enable-threads = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.