当前位置:网站首页>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
边栏推荐
- websocket+probuf.原理篇
- 当 TiDB 与 Flink 相结合:高效、易用的实时数仓
- How did I lose control of the team?
- 年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
- ECMAScript7规范中的instanceof操作符
- Business facade and business rule
- 是时候结束 BERTology了
- Implementation of Caesar cipher
- The JS solution cannot be executed after Ajax loads HTML
- On the coverage technology and best practice of go code
猜你喜欢

一万四千字分布式事务原理解析,全部掌握你还怕面试被问?

What should be considered in the promotion plan outside the station?

Advanced concurrent programming series 9 (lock interface analysis)

Count the frequency of letters in text (case insensitive)

laravel8更新之维护模式改进

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

Git代码提交操作,以及git push提示failed to push some refs'XXX'

Reflection on a case of bus card being stolen and swiped

bgfx编译教程

Summary of the resumption of a 618 promotion project
随机推荐
Code Review最佳实践
How to learn technology efficiently
Web API series (3) unified exception handling
高级并发编程系列九(Lock接口分析)
从技术谈到管理,把系统优化的技术用到企业管理
Tips for Mac novices
阿里terway源码分析
盘点那些争议最大的编程观点,你是什么看法呢?
使用 Xunit.DependencyInjection 改造测试项目
构造请求日志分析系统
static+代码块+多态+异常
不懂数据库索引的底层原理?那是因为你心里没点b树
我是如何失去团队掌控的?
一文详解微服务架构
In the age of screen reading, we suffer from attention deficit syndrome
Facebook开源框架如何简化 PyTorch 实验
Kylin on kubernetes' practice on eBay
laravel8更新之维护模式改进
There's not much time left for Kwai Chung.
The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages