Answer the question
In order to leave comments, you need to log in
How to make a class method a Celery task?
I'm digging through one abandoned repository on GitHub, and there the class method is used as a task in Celery,
i.e.
class SomeClass(object):
def __init__(self, celery):
self.task = celery.task(self.task_method)
def task_method(self, param1, param2):
return param1 + param2
def _logic(self):
foo = self.task.s(param1, param2)
return foo.apply_async()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question