Scenario: We’re migrating our queuing service from Py RQ to Celery/Redis. The codebase is >90% on Django/DRF.

Problem Statement: PyRQ has a “Requeue All” functionality that retries all the failed messages in the queue. We want the same kind of manual retry functionality available in Celery. Celery has a tremendous Auto-retry mechanism, but there are a lot of instances where there’s a code bug causing the async task to fail.

Solution: Since the team is most familiar with Django and its simple built-in Django Admin interface, I decided to create a Django Admin Action that allows us to select the tasks that need to be sent back for retrying.

Here’s the code for the Django Admin Action — https://gist.github.com/sameerkumar18/e792fa6026e063eaef695b3c271959e6
Django Admin Interface with Retry Action (uses Django-celery-results)

Future improvements: Evaluate if this Retry functionality makes more sense to be placed inside Celery Flower interface.

It’s my first week working part-time on Celery; let me know if you have any suggestions for a better approach :)

Thanks!
Sameer (sam+celery@sameerkumar.website)