@selwin Is PR #391 could get the FinishedQueue? I haven't see any modifications of it could show me to get the FinishedQueue directly.
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.
Most helpful comment
The easiest way to get all jobs in a registry would be: