11👍
✅
You can look at the is_eager
or called_directly
attributes of self.request
within the task (the documentation currently isn’t very clear on the difference):
@app.task(bind=True)
def task_with_context(self, *args, **kwargs):
print self.request.is_eager, self.request.called_directly
Source:stackexchange.com