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

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

  •  
  •   VforVendetta · 35 天前 via Android · 1352 次点击
    这是一个创建于 35 天前的主题,其中的信息可能已经有所发展或是发生改变。

    发现 Celery 4.2.3 不支持类方法

    例子:

    class Demo:
      @app.task
      @classmethod
      def test(cls):
          pass
          
    
    schedule 注册任务:
    Demo.test
    2 条回复    2025-10-16 20:12:10 +08:00
    chenzi0103
        1
    chenzi0103  
       33 天前
    直接用 ray 不行吗 celery 写起来太费劲了
    rev1si0n
        2
    rev1si0n  
       4 天前
    什么叫做不支持?
    1. 你可以继承 Task 类写
    2. 你可以用 base class + bind 指定
    为什么要支持?
    1. 鬼知道你类在哪初始化了?
    2. 谁知道你用了什么 pool ?
    3. 多看看文档
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   4007 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 00:10 · PVG 08:10 · LAX 17:10 · JFK 20:10
    ♥ Do have faith in what you're doing.