V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
mrchi
V2EX  ›  Python

Python Celery 任务的 signal 和 handler 该如何选择

  •  
  •   mrchi ·
    mrchi · Apr 19, 2020 · 1792 views
    This topic created in 2202 days ago, the information mentioned may be changed or developed.

    假如我要实现在 task 运行失败后做一些事情,比如修改数据库记录的状态,可以这样实现:

    这两种方式都可以实现需求。请教各位,使用上是否有差异呢?该如何选择呢?

    我的理解

    • task signal 是与 celery app 绑定的;
    • Task.on_failure 是与 Task 类绑定的;
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2634 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:27 · PVG 19:27 · LAX 04:27 · JFK 07:27
    ♥ Do have faith in what you're doing.