当前位置:网站首页>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
边栏推荐
- Summary of the resumption of a 618 promotion project
- The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
- Dynamic programming -- state compression DP of set represented by binary
- 来自不同行业领域的50多个对象检测数据集
- MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
- Git代码提交操作,以及git push提示failed to push some refs'XXX'
- The most hard core of the whole network explains the computer startup process
- 如何高效的学习技术
- If you want to forget the WiFi network you used to connect to your Mac, try this!
- Got timeout reading communication packets解决方法
猜你喜欢

The JS solution cannot be executed after Ajax loads HTML

C语言Ⅰ博客作业03

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

A detailed explanation of microservice architecture

The CPU does this without the memory

盘点那些争议最大的编程观点,你是什么看法呢?

MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法

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

use Xunit.DependencyInjection Transformation test project

京淘项目day09
随机推荐
When tidb and Flink are combined: efficient and easy to use real-time data warehouse
Web安全(二)---跨域资源共享
Stack bracket matching
Improvement of maintenance mode of laravel8 update
bgfx编译教程
Thinkphp6中where条件中字段与字段比较条件的写法
「混合云」会是云计算的下一个战场吗?
盘点那些争议最大的编程观点,你是什么看法呢?
使用 Xunit.DependencyInjection 改造测试项目
不要把异常当做业务逻辑,这性能可能你无法承受
当 TiDB 与 Flink 相结合:高效、易用的实时数仓
In the age of screen reading, we suffer from attention deficit syndrome
建议患者自杀,OpenAI警告:GPT-3用于医疗目的风险太高
Code Review最佳实践
graph generation model
sed之查找替换
laravel8更新之维护模式改进
delphi10的rest.json与system.json的踩坑
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
分享几个我日常使用的VS Code插件