get a page of jobs

This commit is contained in:
Alex Morega 2013-02-13 10:17:36 +02:00 committed by Vincent Driessen
parent ef0f04bff6
commit e3075ea6be
1 changed files with 5 additions and 0 deletions

View File

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