当前位置:网站首页>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
边栏推荐
- Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
- 留给快手的时间不多了
- Ac86u KX Online
- Web API系列(三)统一异常处理
- graph generation model
- 工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
- How to think in the way of computer
- Implementation of Caesar cipher
- 高级并发编程系列九(Lock接口分析)
- Stack bracket matching
猜你喜欢

不要把异常当做业务逻辑,这性能可能你无法承受

大数据算法——布隆过滤器

工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?

Why do we need software engineering -- looking at a simple project

三步一坑五步一雷,高速成长下的技术团队怎么带?

Insight -- the application of sanet in arbitrary style transfer

Web API系列(三)统一异常处理

Business Facade 与 Business Rule

From technology to management, the technology of system optimization is applied to enterprise management

chrome浏览器跨域Cookie的SameSite问题导致访问iframe内嵌页面异常
随机推荐
There's not much time left for Kwai Chung.
Exploration and practice of growingio responsive programming
What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?
MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
盘点那些争议最大的编程观点,你是什么看法呢?
当 TiDB 与 Flink 相结合:高效、易用的实时数仓
看一遍就理解,图解单链表反转
Implementation of multi GPU distributed training with horovod in Amazon sagemaker pipeline mode
websocket+probuf.原理篇
delphi10的rest.json与system.json的踩坑
Technical debt is a lack of real understanding of business functions- daverupert.com
awk实现类sql的join操作
Using thread communication to solve the problem of cache penetrating database avalanche
Let's talk about the locks in the database
Adobe Prelude /Pl 2020软件安装包(附安装教程)
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
京淘项目day09
AFO
[random talk] the goal and way of software design