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

Celery 不支持类方法吗?静态方法呢

  •  
  •   VforVendetta · Sep 15, 2025 via Android · 2471 views
    This topic created in 266 days ago, the information mentioned may be changed or developed.

    发现 Celery 4.2.3 不支持类方法

    例子:

    class Demo:
      @app.task
      @classmethod
      def test(cls):
          pass
          
    
    schedule 注册任务:
    Demo.test
    2 replies    2025-10-16 20:12:10 +08:00
    chenzi0103
        1
    chenzi0103  
       Sep 17, 2025
    直接用 ray 不行吗 celery 写起来太费劲了
    rev1si0n
        2
    rev1si0n  
       Oct 16, 2025
    什么叫做不支持?
    1. 你可以继承 Task 类写
    2. 你可以用 base class + bind 指定
    为什么要支持?
    1. 鬼知道你类在哪初始化了?
    2. 谁知道你用了什么 pool ?
    3. 多看看文档
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1253 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 17:28 · PVG 01:28 · LAX 10:28 · JFK 13:28
    ♥ Do have faith in what you're doing.