实现启动/停止/重新启动命令,同时支持supervisor的并行和通配符。
supervisor-wildcards的Python项目详细描述
说明
将mstop、mstart和mrestart命令添加到Supervisor。这些命令的工作方式分别类似于stop、start和restart,但是它们:
- 添加对进程名通配符的支持,
- 并行发送启动/停止/重启信号(这使批处理命令完成得更快)。
在某些情况下,可以在Supervisor中使用组支持,但它不允许在多个组中有一个进程。这时通配符就非常有用了。
示例
supervisor> status celery-a RUNNING pid 15085, uptime 0:00:11 celery-b RUNNING pid 15086, uptime 0:00:12 gunicorn-a RUNNING pid 14151, uptime 0:05:18 gunicorn-b RUNNING pid 14237, uptime 0:04:45 supervisor> mstop *-a celery-a: stopped gunicorn-a: stopped supervisor>
安装
pip install supervisor-wildcards
然后添加到supervisor.conf中:
[ctlplugin:wildcards] supervisor.ctl_factory = supervisorwildcards.controllerplugin:make_wildcards_controllerplugin
配置
[ctlplugin:wildcards] supervisor.ctl_factory = supervisorwildcards.controllerplugin:make_wildcards_controllerplugin match_group = 1
默认情况下,supervisorwildcards插件仅根据进程名(而不是组)匹配通配符设置match_group=1将尝试将模式与“group_name:process_name”匹配。
变更日志
- 0.1.3
- ^{tt7}$ parameter expands to ^{tt8}$
- Added ^{tt9}$ config option
- 0.1.2
- Fixed matching processes that are assigned to a group
- 0.1.1
- Commands are run in parallel (Thanks, Honza Kral)
- 0.1.0
- Simple support for ^{tt1}$, ^{tt2}$, ^{tt3}$