I've been using an abstract Task and overriding the __call__ method to handle some things before each task executed like such:
class CoreTaskHandler(Task):
abstract = True
def __call__(self, *args, **kwargs):
But the __call__ method gets executed on the worker, I need some override that will get executed on main, not the worker each time the task gets "delayed".
Does anyone have an idea how would I go on about doing that?
I have fixed this by overriding the apply_sync method in Task:
class CoreTaskHandler(Task):
abstract = True
def apply_async(self, *args, **kwargs):
........
return super(CoreTaskHandler, self).apply_async(*args, **kwargs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With