I'm currently working on a project using Django 1.3 with the Django-Celery app. It's pretty awesome, by the way, I suggest anyone who's not familiar with celery check it out.
I have a specific question around the admin page functionality:
We're using celery tasks to make RESTful API calls to third party partners. These calls are actually kicked off by a user action, so you could see how a celery task would be extremely useful in this case.
We have a user story around how an admin should be able to re-send a callback if it fails for some reason. Now, if the callback fails with a standard HTTP response failure, we are using the celery retry mechanism to automatically resend them at various intervals. However, these callbacks could be to one of any thousands of partners (yea, theres a lot), and not all of them will use a standard HTTP Response code as their failure response.
Long story short, I haven't been able to find anything online that states that one can re-send a celery task through the admin interface. I was hoping that someone could shed some light on this. It seems like a pretty obvious piece of functionality to have, and if there is no such functionality I'm sure there's a good reason for it. I'd love it if there isn't a way to do it, if someone could explain the reason. Just curious to learn more about the internal workings of celery.
Thanks everyone! Sorry for my wordiness, sometimes I tend to ramble.
You can try two approaches,
1: Small hack in model:
You can use a boolean field and name it something like celery_retry and in models save method do something like this.
def save(self, *args, **kwargs):
if self.celery_retry and self.user.is_superuser():
celery_task.apply_async()
self.celery_retry = False
super(MyModel, self).save(*args, **kwargs)
This is just an idea, you can determine your own how and when to submit celery task back.
2:Extend admin template:
You can extend the admin template and put in a hyperlink to a view which resubmits the task.
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