当前位置:网站首页>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
边栏推荐
- delphi10的rest.json与system.json的踩坑
- C language I blog assignment 03
- 统计文本中字母的频次(不区分大小写)
- Reflection on a case of bus card being stolen and swiped
- 技术债务是对业务功能缺乏真正的理解 -daverupert.com
- A detailed explanation of microservice architecture
- C language I blog assignment 03
- The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages
- 如何高效的学习技术
- 凯撒密码实现
猜你喜欢
随机推荐
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
Don't treat exceptions as business logic, which you can't afford
什么都2020了,LINQ查询你还在用表达式树
Bgfx compilation tutorial
「混合云」会是云计算的下一个战场吗?
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
ngnix集群高并发
Count the frequency of letters in text (case insensitive)
从技术谈到管理,把系统优化的技术用到企业管理
计组-总线通信控制之异步串行通信的数据传输
不要把异常当做业务逻辑,这性能可能你无法承受
Web安全(一)---浏览器同源策略
Business Facade 与 Business Rule
Adobe media encoder /Me 2021软件安装包(附安装教程)
What is the relationship between low code vs model driven?
Adobe Lightroom /Lr 2021软件安装包(附安装教程)
What magic things can a line of Python code do?
Got timeout reading communication packets解决方法
低代码 vs 模型驱动,它们之间到底是什么关系?
[C + + learning notes] how about the simple use of the C + + standard library STD:: thread?





