推荐学习书目
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
loliordie
V2EX  ›  Python

celery 有没有什么好办法知道任务跑完了?

  •  
  •   loliordie · Jan 19, 2020 · 3639 views
    This topic created in 2318 days ago, the information mentioned may be changed or developed.

    我的做法是把每一个任务加到 list 里面去 然后循环检查 list 里面任务的状态 如果一个任务卡超过 10 分钟就认为失败检查下一个 不过经常 rabbitmq 堵塞导致所有任务都是 pending 的状态 所以就会一直等...

    2 replies    2020-01-20 10:30:24 +08:00
    NaVient
        1
    NaVient  
       Jan 20, 2020
    你自己再搞个队列在异步任务里包装一个方法,任务执行结束发一个消息到队列,消费者接到消息处理不就行了?
    retanoj
        2
    retanoj  
       Jan 20, 2020
    是怕一个任务执行时间太长或者 block 住吧?
    http://einverne.github.io/post/2017/05/celery-best-practice.html#%E8%AE%BE%E7%BD%AE-task-%E8%B6%85%E6%97%B6
    里写,可以设置个全局超时时间
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   915 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:19 · PVG 05:19 · LAX 14:19 · JFK 17:19
    ♥ Do have faith in what you're doing.