Closed rodrigondec closed 1 year ago
can you please check the CI failures?
Yes, I was awaiting the maintainer approval for the CI to run :grin:
anything else you want to add or improve in this PR?
No, for me it's good to go :rocket:
There's a roadmap with this PR on a release? There's a expected date for the new version?
if possible this week, if not in this month
@rodrigondec @auvipy I still have this problem with the latest version (2.5.1)
self.update_state(state='RUNNING', meta={'current': order_counter, 'total': total_order})
@cdevacc1 I have the same problem, see issue #367. In your screenshot though, I think it might be because RUNNING
is not one of the task states defined within the library. If you look at my screenshot here, you can see PROGRESS
printed next to the task ID, but the actual task state field is set to -
like yours.
@ericswpark Yes. I looked through models.py, status must be in celery.states.ALL_STATES ['FAILURE', 'PENDING', 'RECEIVED', 'RETRY', 'REVOKED', 'STARTED', 'SUCCESS']
status = models.CharField(
max_length=50, default=states.PENDING,
choices=TASK_STATE_CHOICES,
verbose_name=_('Task State'),
help_text=_('Current state of the task being run'))
ShouId I remove choices from status field to make it work with custom states?
@cdevacc1 that would be great :)
For me the example from the "injecting-metadata" file is not working at all. No matter what i do, the information i put in request.meta or the update_state function, the info is nowhere to be found :(
"Result Data" only shows the pid and hostname. ( i dont write that in there, so must come from somewhere else ^^ )
@cdevacc1 decided to tackle this issue today so I just made a PR from your comment. See ^
Resume
The issue #37 points to save data using the arg
meta
from the methodupdate_state
, but themeta
attribute is renamed toresult
when it is passed toself.backend.store_result
.As explained here in this comment https://github.com/celery/django-celery-results/issues/37#issuecomment-385203222.
Problem
So the argued
meta
arg onstore_result
is not really arbitrary metadata. It's actually the result of the Task.Solution
Use the TaskResult.meta to store arbitrary data.
How to inject?
I implemented the meta injection through the Task Celery Request. This way I don't mess around with too many implementations and function signatures.