Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get all Finished Jobs by Queue.? #842

Closed
jkryanchou opened this issue May 16, 2017 · 7 comments
Closed

How to get all Finished Jobs by Queue.? #842

jkryanchou opened this issue May 16, 2017 · 7 comments

Comments

@jkryanchou
Copy link

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

@jkryanchou
Copy link
Author

Anyone could help me out with this issue?

@scroogie
Copy link

scroogie commented Jun 7, 2017

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

@jkryanchou
Copy link
Author

@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.

1 similar comment
@jkryanchou
Copy link
Author

@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.

@selwin
Copy link
Collaborator

selwin commented Aug 7, 2017

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 selwin closed this as completed Aug 7, 2017
@jkryanchou
Copy link
Author

@selwin OK, Got it. Thanks a lot

@flavioribeiro
Copy link

flavioribeiro commented Aug 23, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants