推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
fxxkgw
V2EX  ›  Python

celery worker 启动路径问题。

  •  
  •   fxxkgw · Jun 27, 2018 · 2066 views
    This topic created in 3015 days ago, the information mentioned may be changed or developed.

    django 项目,例如在 /test/server/目录下执行 python manage.py celery worker -l info -c 30 -Ofair
    启用了 30 个 worker,使用 pwdx 查看某个 worker 工作路径,显示在 /test/server,一切正常。

    因为系统设置了 CELERYD_MAX_TASKS_PER_CHILD = 40 参数,也就是每个 worker 最多接收 40 次任务后就销毁重建。
    重建的 worker 使用 pwdx 或者 ls -l /proc/pid/ 方式查看,发现 cwd 目录并不是上述的 /test/server,而是某个任务中曾经读写过的路径。
    很奇怪这种现象,使用 CELERYD_CHDIR='/test/server/' 是否就能解决这个问题呢?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4107 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 00:06 · PVG 08:06 · LAX 17:06 · JFK 20:06
    ♥ Do have faith in what you're doing.