1
gfreezy 2013-07-14 22:09:14 +08:00
新写一个function作为celery_task,里面调用 类成员方法
|
2
yishenggudou 2013-07-15 10:38:40 +08:00 1
celery 太折腾 不推荐
|
3
zhenyi2697 2013-07-15 14:27:27 +08:00
@yishenggudou 那消息队列有什么推荐的呢?
|
4
ritksm 2013-07-15 14:33:09 +08:00
|
7
kenneth OP |
13
kenneth OP @wenbinwu
Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 233, in trace_task R = retval = fun(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 420, in __protected_call__ return self.run(*args, **kwargs) None: process() takes exactly 1 argument (0 given) |
14
ritksm 2013-07-15 15:45:33 +08:00
参见以下代码:
from celery import Celery from celery.contrib.methods import task_method celery = Celery('xxxxx', broker='xxxxxx') class A(object): @celery.task(filter=task_method) def process(self): print('ok') return |
16
ritksm 2013-07-15 15:53:21 +08:00
如何不跑了。。。我咋就可以出结果。。。难道要我截图出来么。。。错误信息?shell是如何调用celery的。。。
|
17
kenneth OP @ritksm 没有错误,只是worker收不到job。我们加下Gtalk交流吧:[email protected]
|
18
Archangel_SDY 2013-07-15 16:51:22 +08:00
看看broker的log呢?
上次被RabbitMQ的1G磁盘剩余空间要求坑了整整一晚上... |
19
zhenyi2697 2013-07-15 20:25:07 +08:00
@kenneth 貌似调用celery需要task所在的module是一个celerymodule
也就是说,你需要先运行 celery = Celery('xxxxx', broker='xxxxxx') 创建一个celery的app,然后再写你的task。 另外,你需要运行一个celery的worker,参考 celery -A app_name worker --loglevel=info |