当前位置:网站首页>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
边栏推荐
猜你喜欢

构造请求日志分析系统

Awk implements SQL like join operation

Using pipe() to improve code readability in pandas

技术总监7年自述——如何选择一家好公司

来自不同行业领域的50多个对象检测数据集

Let's talk about the locks in the database

Reflection on a case of bus card being stolen and swiped

What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?

Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?

C language I blog assignment 03
随机推荐
Facebook开源框架如何简化 PyTorch 实验
The JS solution cannot be executed after Ajax loads HTML
Bgfx compilation tutorial
Don't treat exceptions as business logic, which you can't afford
How did I lose control of the team?
Business facade and business rule
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
Kylin on Kubernetes 在 eBay 的实践
Technical debt is a lack of real understanding of business functions- daverupert.com
使用 Xunit.DependencyInjection 改造测试项目
Win10官方1909版本无法打开windows安全中心中病毒和威胁防护的实时保护解决方案。
[original] the influence of arm platform memory and cache on the real-time performance of xenomai
计组-总线通信控制之异步串行通信的数据传输
构造请求日志分析系统
laravel8更新之维护模式改进
Reflection on a case of bus card being stolen and swiped
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
use Xunit.DependencyInjection Transformation test project
C语言I博客作业03
What magic things can a line of Python code do?