当前位置:网站首页>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
边栏推荐
- 是时候结束 BERTology了
- 技术总监7年自述——如何选择一家好公司
- Awk implements SQL like join operation
- In the age of screen reading, we suffer from attention deficit syndrome
- Kylin on kubernetes' practice on eBay
- Advanced concurrent programming series 9 (lock interface analysis)
- C语言I博客作业03
- What should be considered in the promotion plan outside the station?
- What do you think of the most controversial programming ideas?
- Adobe Lightroom /Lr 2021软件安装包(附安装教程)
猜你喜欢
The CPU does this without the memory
Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart
[original] the influence of arm platform memory and cache on the real-time performance of xenomai
Using pipe() to improve code readability in pandas
Annual salary of 900000 programmers is not as good as 3800 civil servants a month? How to choose between stability and high income?
工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
浅谈HiZ-buffer
Git code submission operation, and git push prompt failed to push some refs'xxx '
三步一坑五步一雷,高速成长下的技术团队怎么带?
websocket+probuf.原理篇
随机推荐
Using thread communication to solve the problem of cache penetrating database avalanche
分享几个我日常使用的VS Code插件
C language I blog assignment 03
awk实现类sql的join操作
Big data algorithm - bloon filter
It's time to end bertology
Stack bracket matching
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
Awk implements SQL like join operation
Why do we need software engineering -- looking at a simple project
如何应对事关业务生死的数据泄露和删改?
Summary of the resumption of a 618 promotion project
Ac86u KX Online
Using pipe() to improve code readability in pandas
The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
30岁后,你还剩下什么?
Don't treat exceptions as business logic, which you can't afford
The most hard core of the whole network explains the computer startup process
聊聊Go代码覆盖率技术与最佳实践