Rq: How to get all Finished Jobs by Queue.?

Created on 16 May 2017  路  7Comments  路  Source: rq/rq

@selwin Is PR #391 could get the FinishedQueue? I haven't see any modifications of it could show me to get the FinishedQueue directly.

Most helpful comment

The easiest way to get all jobs in a registry would be:

registry = FinishedJobRegistry('default', connection=redis)
job_ids = registry.get_job_ids() # You can then turn these into Job instances

All 7 comments

Anyone could help me out with this issue?

Have a look at registry.py. There are multiple registries available: StartedJobRegistry, FinishedJobRegistry and DeferredJobRegistry, where you can get the job_ids from.

@scroogie OK, I have got insight into source code finally got the same way as you said. While registry was store as zset. It wasn't convenient pop as a Queue. It was required to implement a pop interface to do it.

@scroogie OK, I have got insight into source code finally got the same way as you said. While registry was store as zset. It wasn't convenient pop as a Queue. It was required to implement a pop interface to do it.

The easiest way to get all jobs in a registry would be:

registry = FinishedJobRegistry('default', connection=redis)
job_ids = registry.get_job_ids() # You can then turn these into Job instances

@selwin OK, Got it. Thanks a lot

Just to complement this, after getting the list of job_ids from the registry, I could use:

from rq import job
from redis import Redis

job.Job.fetch("job-id-here", connection=Redis())

to fetch the real job object from the queue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

f0cker picture f0cker  路  4Comments

guhcampos picture guhcampos  路  8Comments

mitakuye picture mitakuye  路  7Comments

mateocam picture mateocam  路  5Comments

yishenggudou picture yishenggudou  路  8Comments