Rq: Clear stale data in Redis with a simple command line command

Created on 3 Sep 2012  ·  3Comments  ·  Source: rq/rq

Using RQ for a while, stale data can get piled up in Redis. Most notably dead workers and a full failed queue.

We should provide a simple means of discarding that data on the command line.

Best place I can think of for that now is rqinfo --clear of some sort. Open for discussion/tips.

Most helpful comment

I have a need for the same thing... Does something like this work?

from redis import Redis
from rq import Queue
from rq import Worker

q = Queue(connection=Redis())
low = Queue('low',connection=Redis())
failed = Queue('failed',connection=Redis())

q.empty()
low.empty()
failed.empty()


for w in Worker.all(connection=Redis()):
    print w.register_death()

All 3 comments

I have a need for the same thing... Does something like this work?

from redis import Redis
from rq import Queue
from rq import Worker

q = Queue(connection=Redis())
low = Queue('low',connection=Redis())
failed = Queue('failed',connection=Redis())

q.empty()
low.empty()
failed.empty()


for w in Worker.all(connection=Redis()):
    print w.register_death()

Would a command such as rqinfo --clear also remove queues?

+1 for this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitsuyui picture kitsuyui  ·  4Comments

willvousden picture willvousden  ·  7Comments

cw1427 picture cw1427  ·  4Comments

EliFinkelshteyn picture EliFinkelshteyn  ·  7Comments

f0cker picture f0cker  ·  4Comments