python rq - How to clear Django RQ jobs from a queue? -


i feel bit stupid asking, doesn't appear in documentation rq. have 'failed' queue thousands of items in , want clear using django admin interface. admin interface lists them , allows me delete , re-queue them individually can't believe have dive django shell in bulk.

what have missed?

the queue class has empty() method can accessed like:

import django_rq q = django_rq.get_failed_queue() q.empty() 

however, in tests, cleared failed list key in redis, not job keys itself. thousands of jobs still occupy redis memory. prevent happening, must remove jobs individually:

import django_rq q = django_rq.get_failed_queue() while true:     job = q.dequeue()     if not job:         break     job.delete()  # delete key redis 

as having button in admin interface, you'd have change django-rq/templates/django-rq/jobs.html template, extends admin/base_site.html, , doesn't seem give room customizing.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -