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
loliordie
V2EX  ›  Python

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

  •  
  •   loliordie · 2020-01-19 21:40:33 +08:00 · 2988 次点击
    这是一个创建于 1552 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    2 条回复    2020-01-20 10:30:24 +08:00
    NaVient
        1
    NaVient  
       2020-01-20 10:25:17 +08:00
    你自己再搞个队列在异步任务里包装一个方法,任务执行结束发一个消息到队列,消费者接到消息处理不就行了?
    retanoj
        2
    retanoj  
       2020-01-20 10:30:24 +08:00
    是怕一个任务执行时间太长或者 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
    里写,可以设置个全局超时时间
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2921 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 02:54 · PVG 10:54 · LAX 19:54 · JFK 22:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.