V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2018-06-27 18:49:15 +08:00 · 1650 次点击
    这是一个创建于 2119 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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/' 是否就能解决这个问题呢?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5547 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 08:34 · PVG 16:34 · LAX 01:34 · JFK 04:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.