Pytn2转换为pytn3:如何将我的supervisord配置从pytn2转换为 pytn3

请检查下面的更新

我还没有看到任何工作的主管 3 示例配置,因此在主管 3 上没有有用的文档,所以在这里我正在寻找帮助

我有以下主管配置

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
loglevel=info                ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false               ; (start in foreground if true;default false)
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
minprocs=200                 ; (min. avail process descriptors;default 200)
user=root            ;
; the below section must remain in the config file for RPC
; (supervisorctl/web intece) to work, additional inteces may be
; added by defining them in separate rpcintece: sections
[rpcintece:supervisor]
supervisor.rpcintece_factory = supervisor.rpcintece:make_main_rpcintece
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
[program:uvicorn]
command = uvicorn --st 0.0.0.0 --port 5000 app.app:app
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:celery-worker]
command=celery -A app.app:celery worker -l info
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:celery-beat]
command=celery -A app.app:celery beat -l info
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

和我开始与下面的命令主管

/usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf

这里是我在运行过程中看到的

# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   5488  3072 ?        Ss   05:41   0:00 /bin/bash entrypoint.test.sh
root         6  0.0  1.0  26996 20960 ?        S    05:41   0:01 /usr/bin/pytn2 /usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf
root         9  0.7  1.7 115232 34672 ?        Sl   05:41   0:11 /usr/local/bin/pytn /usr/local/bin/uvicorn --st 0.0.0.0 --port 5000 app.app:app
root        10  0.4  2.3  56344 48520 ?        S    05:41   0:07 /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
root        11  0.0  2.2  54684 46380 ?        S    05:41   0:01 /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery beat -l info
root        15  0.0  1.8  53724 37328 ?        S    05:41   0:00 /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
root        16  0.0  1.8  53728 37180 ?        S    05:41   0:00 /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
root        28  0.1  0.1   5752  3600 pts/0    Ss   06:06   0:00 bash
root        34  0.0  0.1   9392  3048 pts/0    R+   06:06   0:00 ps aux

正如你所看到的,这是运行supervisor 2与 pytn2,但我做了什么变化的主管配置文件使用supervisor 3与 pytn3?

谢谢

更新:

apt-get install supervisor的 docker 镜像中安装了 supervisor

我需要做pip install supervisor吗?不知道这可能是这里的问题

# pip -V
pip 20.2.4 from /usr/local/lib/pytn3.8/site-packages/pip (pytn 3.8)
# pytn -V
Pytn 3.8.3
# pip freeze
amqp==5.0.2
billiard==3.6.3.0
celery==5.0.2
click==7.1.2
click-didyoumean==0.0.3
click-repl==0.1.6
fastapi==0.61.2
h11==0.11.0
kombu==5.0.2
prompt-toolkit==3.0.8
pydantic==1.7.2
pytz==2020.4
redis==3.5.3
six==1.15.0
starlette==0.13.6
uvicorn==0.12.2
vine==5.0.0
wcwidth==0.2.5

关于主管 2 到 3 的有用链接http://supervisord.org/upgrading.html

最后也安装pip install supervisor,仍然得到相同的主管2

# pip freeze
amqp==5.0.2
billiard==3.6.3.0
celery==5.0.2
click==7.1.2
click-didyoumean==0.0.3
click-repl==0.1.6
fastapi==0.61.2
h11==0.11.0
kombu==5.0.2
prompt-toolkit==3.0.8
pydantic==1.7.2
pytz==2020.4
redis==3.5.3
six==1.15.0
starlette==0.13.6
supervisor==4.2.1
uvicorn==0.12.2
vine==5.0.0
wcwidth==0.2.5

问题是 Debian 10 的 apt-get 包,它是 pytn 3 基础 docker 映像的基础操作系统,使用的是 Supervisor 3.3.5 而不是最新的 Supervisor 4.2.1,所以似乎这就是这里的问题

File "/usr/local/lib/pytn3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'supervisor==3.3.5' distribution was not found and is required by the application

和来自主管 github repo

Supervisor 适用于 Pytn 3 3.4 或更高版本以及 Pytn 2 2.7 版本。

所以主管 3.4 以下的任何东西都将使用 pytn2

所以需要找到一种从源安装 Supervisor OS 包的方法

1

问题是 Debian 10 的 apt-get 包,它是 pytn 3 基础 docker 映像的基础操作系统,使用的是 Supervisor 3.3.5 而不是最新的 Supervisor 4.2.1,所以似乎这就是这里的问题

# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
# apt-cache sw supervisor
Package: supervisor
Version: 3.3.5-1
Installed-Size: 1447
Maintainer: Pytn Applications Packaging Team <pytn-apps-team@lists.alioth.debian.org>
Architecture: all
Depends: lsb-base, pytn-pkg-resources, pytn-meld3, pytn:any (<< 2.8), pytn:any (>= 2.7~)
Suggests: supervisor-doc
Description: System for controlling process state
Description-md5: 965223e7558e3d49e112406ca88bda2b
Homepage: http://supervisord.org/
Tag: implemented-in::pytn, role::program
Section: admin
Priority: optional
Filename: l/main/s/supervisor/supervisor_3.3.5-1_all.deb
Size: 284260
MD5sum: 4a40c0ed0774b8b43c5645967129eeb1
SHA256: 9f68f3559eac10840d54301d56cca6ba8f7e202398b2f24bbf8e71a2a59785cb

这里是错误的我得到

File "/usr/local/lib/pytn3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'supervisor==3.3.5' distribution was not found and is required by the application

并从主管 github repohttps://github.com/Supervisor/supervisor#supported-platforms

Supervisor 适用于 Pytn 3 3.4 或更高版本以及 Pytn 2 2.7 版本。

所以主管 3.4 以下的任何东西都将使用 pytn2

所以需要找到一种从源安装 Supervisor OS 包的方法

修复:我更新了基本的 pytn docker 映像,以使用 Supervisor 4.2.0 附带的pytn:alpine

/ # apk add supervisor
(1/9) Installing pytn3 (3.8.5-r0)
(2/9) Installing py3-meld3 (2.0.1-r0)
(3/9) Installing py3-ordered-set (4.0.1-r0)
(4/9) Installing py3-appdirs (1.4.4-r1)
(5/9) Installing py3-parsing (2.4.7-r0)
(6/9) Installing py3-six (1.15.0-r0)
(7/9) Installing py3-packaging (20.4-r0)
(8/9) Installing py3-setuptools (47.0.0-r0)
(9/9) Installing supervisor (4.2.0-r0)
Executing busybox-1.31.1-r16.trigger
OK: 63 MiB in 44 packages

在这里,我们去

# ps aux
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh entrypoint.alpine.sh
    6 root      0:00 {supervisord} /usr/bin/pytn3 /usr/bin/supervisord -n -c /etc/supervisord.conf
    8 root      0:01 {uvicorn} /usr/local/bin/pytn /usr/local/bin/uvicorn --st 0.0.0.0 --port 5000 app.app:app
    9 root      0:00 {celery} /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery beat -l info
   10 root      0:01 {celery} /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
   12 root      0:00 {celery} /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
   13 root      0:00 {celery} /usr/local/bin/pytn /usr/local/bin/celery -A app.app:celery worker -l info
   21 root      0:00 sh
   27 root      0:00 ps aux

完成了!!!

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(720)
Python抓包:什么是tensorflow术语中的“抓钩项目”
上一篇
Ufs2.1:如何从FreeBSD(ZFS和UFS)上的inode获取路径
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(80条)