From e3075ea6be3cfb88c71a1a0d36202d4c51473afb Mon Sep 17 00:00:00 2001 From: Alex Morega Date: Wed, 13 Feb 2013 10:17:36 +0200 Subject: [PATCH] get a page of jobs --- rq/queue.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rq/queue.py b/rq/queue.py index 05c8394..739b659 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -74,6 +74,11 @@ class Queue(object): return None return job + def get_jobs_page(self, offset, limit): + """Returns a paginated list of jobs in the queue.""" + job_ids = self.connection.lrange(self.key, offset, offset+limit) + return compact([self.safe_fetch_job(job_id) for job_id in job_ids]) + @property def job_ids(self): """Returns a list of all job IDS in the queue."""