2

AttributeError: 'module' object has no attribute 'getrlimit'在尝试手动启动 celeryd_multi 时遇到了问题,无论是手动(python manage.py celeryd_multi...)还是通过 init.d 作为守护进程。

  • 我可以手动启动 celerydpython manage.py celeryd
  • 退出 /etc/default/ celerydCELERYD_MULTI会导致它崩溃并出现以下错误:usr/bin/python: No module named celery.__main__; 'celery' is a package and cannot be directly executed
  • 手动启动 celeryd_multi 也会导致 'getrlimit' 属性错误

这是我的 /etc/default/celeryd 文件的样子:

CELERYD_NODES="w1"
CELERYD_CHDIR="/code/project"

CELERYD_MULTI="python $CELERYD_CHDIR/manage.py celeryd_multi"

CELERYCTL="$CELERYD_CHDIR/manage.py celeryctl"

CELERYD_OPTS="--time-limit=300 --concurrency=8"

CELERY_CONFIG_MODULE="celeryconfig"

CELERYD_LOG_FILE="/var/log/celery/celeryd.log"
CELERYD_PID_FILE="/var/run/celery/celeryd.pid"

CELERYD_USER="celery"
CELERYD_GROUP="celery"

export DJANGO_SETTINGS_MODULE="project.settings"

下面是堆栈跟踪:

> 启动节点...
    > w1.ip-10-28-232-109:好的
ubuntu@ip-10-28-232-109:~$ Traceback(最近一次通话最后一次):
  文件“/code/project/manage.py”,第 14 行,在
    执行管理器(设置)
  文件“/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py”,第 438 行,在 execute_manager
    实用程序.execute()
  文件“/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py”,第 379 行,在执行
    self.fetch_command(子命令).run_from_argv(self.argv)
  文件“/usr/local/lib/python2.7/dist-packages/djcelery/management/commands/celeryd_detach.py​​”,第 26 行,在 run_from_argv
    detached().execute_from_commandline(argv)
  文件“/usr/local/lib/python2.7/dist-packages/celery/bin/celeryd_detach.py​​”,第 146 行,在 execute_from_commandline
    **vars(选项)))
  分离中的文件“/usr/local/lib/python2.7/dist-packages/celery/bin/celeryd_detach.py​​”,第 37 行
    分离(日志文件、pidfile、uid、gid、umask、working_directory、fake):
  文件“/usr/local/lib/python2.7/dist-packages/celery/platforms.py”,第 248 行,打开
    对于 fd 反向(范围(get_fdmax(默认 = 2048))):
  文件“/usr/local/lib/python2.7/dist-packages/celery/platforms.py”,第 83 行,在 get_fdmax
    fdmax = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
AttributeError:“模块”对象没有属性“getrlimit”
4

0 回答 0