当前位置:网站首页>supervisor和Python多进程multiprocessing使用 子进程残留问题
supervisor和Python多进程multiprocessing使用 子进程残留问题
2020-11-07 20:57:00 【Coxhuang】
文章目录
- supervisor 和Python的multiprocessing使用问题
- #1 环境
- #2 需求
- #3 解决 Python多进程和supervisor问题
supervisor 和Python的multiprocessing使用问题
#1 环境
Ubuntu 16.04 Python 3.8.1
#2 需求
- 使用supervisor管理Python程序时, 当Python程序中使用multiprocessing模块,supervisor的stop和restart指令只会杀死主进程,子进程会残留下来
#3 解决 Python多进程和supervisor问题
killasgroup可以说是专门适配了Python的multiprocessing模块,如果配置了stopasgroup=true,那么killasgroup也会默认为true,所以我们只需要配置stopasgroup=true即可,注意stopasgroup和killasgroup发送的信号类型不同。
配置例子 :
[group:multiprocesstest] programs=multiprocess [program:multiprocess] command=python3 /home/cox/work/test/multiprocess_suspend/multiprocess_suspend.py directory=/home/cox user=cox autorestart=true redirect_stderr=true stopasgroup=true
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
版权声明
本文为[Coxhuang]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1744574
边栏推荐
- 浅谈HiZ-buffer
- What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?
- Web API系列(三)统一异常处理
- go wire 依赖注入入门
- Web安全(二)---跨域资源共享
- 大数据算法——布隆过滤器
- How to choose a good company
- 栈-括号的匹配
- The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages
- Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
猜你喜欢
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
看一遍就理解,图解单链表反转
你可能不知道的Animation动画技巧与细节
delphi10的rest.json与system.json的踩坑
聊聊Go代码覆盖率技术与最佳实践
Web API系列(三)统一异常处理
Improvement of maintenance mode of laravel8 update
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
The JS solution cannot be executed after Ajax loads HTML
统计文本中字母的频次(不区分大小写)
随机推荐
Business facade and business rule
Awk implements SQL like join operation
模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
AFO记
Deep into web workers (1)
A detailed explanation of microservice architecture
Exploration and practice of growingio responsive programming
聊聊Go代码覆盖率技术与最佳实践
分享几个我日常使用的VS Code插件
留给快手的时间不多了
Huawei HCIA notes
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
go wire 依赖注入入门
阿里terway源码分析
Web安全(一)---浏览器同源策略
AFO
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
使用“1”个参数调用“DownloadString”时发生异常:“操作超时”
快速上手Git