我有以下supervisord配置,我无法让子进程看到在config中指定的工作目录的根目录中的模块。脚本需要查看/srv/www/company/utils.py文件。
[program:python_worker_2]
command=/opt/company/venv/bin/python scripts/supervisor/python_worker.py
process_name=%(program_name)s_%(process_num)s
numprocs=4
numprocs_start=0
priority=999
autostart=true
autorestart=true
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
user=jobadmn
redirect_stderr=true
stdout_logfile=/var/log/supervisor/python_worker_2_stdout.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
stdout_capture_maxbytes=0
stdout_events_enabled=false
stderr_logfile=/var/log/supervisor/python_worker_2_stderr.log
stderr_logfile_maxbytes=50MB
stderr_logfile_backups=10
stderr_capture_maxbytes=0
stderr_events_enabled=false
directory=/srv/www/company
serverurl=AUTO
我可以使用supervisor配置文件中指定的相同命令手动运行脚本,但是当我尝试在主管中运行作业时,我得到以下内容:
Traceback (most recent call last):
File "scripts/supervisor/python_worker.py", line 8, in <module>
import utils
ImportError: No module named utils