当前位置:网站首页>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
边栏推荐
- DOM节点操作
- When tidb and Flink are combined: efficient and easy to use real-time data warehouse
- use Xunit.DependencyInjection Transformation test project
- 年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
- awk实现类sql的join操作
- Web安全(三)---CSRF攻击
- Big data algorithm - bloon filter
- 微服务的出现和意义的探索
- Git代码提交操作,以及git push提示failed to push some refs'XXX'
- Why do we need software engineering -- looking at a simple project
猜你喜欢

Big data algorithm - bloon filter

The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages

高级并发编程系列九(Lock接口分析)

如何高效的学习技术

On the coverage technology and best practice of go code

Reflection on a case of bus card being stolen and swiped

洞察——风格注意力网络(SANet)在任意风格迁移中的应用

在pandas中使用pipe()提升代码可读性

C language I blog assignment 03

使用“1”个参数调用“DownloadString”时发生异常:“操作超时”
随机推荐
Using thread communication to solve the problem of cache penetrating database avalanche
Git code submission operation, and git push prompt failed to push some refs'xxx '
graph generation model
留给快手的时间不多了
分享几个我日常使用的VS Code插件
C language I blog assignment 03
Bgfx compilation tutorial
go wire 依赖注入入门
In the age of screen reading, we suffer from attention deficit syndrome
Adobe Prelude /Pl 2020软件安装包(附安装教程)
Facebook开源框架如何简化 PyTorch 实验
屏读时代,我们患上了注意力缺失候群症
站外推广的计划需要考虑哪些呢?
Mac新手必备小技巧
京淘项目day09
动态规划——用二进制表示集合的状态压缩DP
建议患者自杀,OpenAI警告:GPT-3用于医疗目的风险太高
想要忘记以前连接到Mac的WiFi网络,试试这个方法!
The most hard core of the whole network explains the computer startup process
聊一聊数据库中的锁