celery / django-celery-results

Celery result back end with django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

task_name always null

csirmazbendeguz opened this issue · comments

The task_name is always null, even if extended task results are enabled.

I checked the code and the request variable doesn't have a task field. I couldn't find where this field was supposed to be added in the Celery source code either.

Not sure if this is a bug or I'm missing something obvious.

'task_name': getattr(request, 'task', None),

My package versions are:

celery==5.2.7
django-celery-results==2.4.0

I also tried to install other versions of django-celery-results, but all of them tries to get the task name from the task field which is never set.

I'm trying to develop a monitoring app for our Celery tasks. Maybe there's an alternative way to do that? Cheers

#289 probably related

Had the same problem, its because of the option CELERY_RESULT_EXTENDED. This needs to be True. It is mentioned in the getting started https://django-celery-results.readthedocs.io/en/latest/getting_started.html. Only the readme is linked to the celery docs where this is not mentioned.

So its easy to miss, also in the docs its not clear that you need this for basic information like task name.

This is the exact reason. Setting this will fix this issue.

Had the same problem, its because of the option CELERY_RESULT_EXTENDED. This needs to be True. It is mentioned in the getting started https://django-celery-results.readthedocs.io/en/latest/getting_started.html. Only the readme is linked to the celery docs where this is not mentioned.

I literally said The task_name is always null, even if extended task results are enabled. in the first sentence.
The issue was with the eager mode.

can you help to find out the root cause of the issue?

@csirmazbendeguz @auvipy did you set CELERY_RESULT_EXTENDED?