Skip to content Skip to sidebar Skip to footer

Celery Python Object Methods

I am trying to get celery tasks wrapper around a python object method. Like: class A: @task def test_task(self,args): print 'BLah..test' def main(): a

Solution 1:

Since version 3.0 Celery now supports using methods as tasks: http://docs.celeryproject.org/en/latest/reference/celery.contrib.methods.html

Solution 2:

Do you need to have test_task as method? Will simple function work? Or could you use static method? BTW, your main function doesn't use celery to execute test_task, it runs it as simple method.

Post a Comment for "Celery Python Object Methods"