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

Deep into web workers (1)

Count the frequency of letters in text (case insensitive)

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

Improvement of maintenance mode of laravel8 update

计组-总线通信控制之异步串行通信的数据传输

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

C language I blog assignment 03

想要忘记以前连接到Mac的WiFi网络,试试这个方法!

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

What should be considered in the promotion plan outside the station?
随机推荐
[random talk] the goal and way of software design
动态规划——用二进制表示集合的状态压缩DP
Exception calling 'downloadstring' with '1' arguments: 'operation timed out'
How Facebook open source framework simplifies pytorch experiment
From technology to management, the technology of system optimization is applied to enterprise management
Using pipe() to improve code readability in pandas
来自不同行业领域的50多个对象检测数据集
技术总监7年自述——如何选择一家好公司
计组-总线通信控制之异步串行通信的数据传输
How to learn technology efficiently
Count the frequency of letters in text (case insensitive)
华为HCIA笔记
What should be considered in the promotion plan outside the station?
Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
Bgfx compilation tutorial
ngnix集群高并发
当 TiDB 与 Flink 相结合:高效、易用的实时数仓
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
Git代码提交操作,以及git push提示failed to push some refs'XXX'
graph generation model