|
|
@ -329,22 +329,22 @@ class Queue(object):
|
|
|
|
|
|
|
|
|
|
|
|
Returns a job_class instance, which can be executed or inspected.
|
|
|
|
Returns a job_class instance, which can be executed or inspected.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
job_id = self.pop_job_id()
|
|
|
|
while True:
|
|
|
|
if job_id is None:
|
|
|
|
job_id = self.pop_job_id()
|
|
|
|
return None
|
|
|
|
if job_id is None:
|
|
|
|
try:
|
|
|
|
return None
|
|
|
|
job = self.job_class.fetch(job_id, connection=self.connection)
|
|
|
|
try:
|
|
|
|
except NoSuchJobError as e:
|
|
|
|
job = self.job_class.fetch(job_id, connection=self.connection)
|
|
|
|
# Silently pass on jobs that don't exist (anymore),
|
|
|
|
except NoSuchJobError as e:
|
|
|
|
# and continue by reinvoking itself recursively
|
|
|
|
# Silently pass on jobs that don't exist (anymore),
|
|
|
|
return self.dequeue()
|
|
|
|
continue
|
|
|
|
except UnpickleError as e:
|
|
|
|
except UnpickleError as e:
|
|
|
|
# Attach queue information on the exception for improved error
|
|
|
|
# Attach queue information on the exception for improved error
|
|
|
|
# reporting
|
|
|
|
# reporting
|
|
|
|
e.job_id = job_id
|
|
|
|
e.job_id = job_id
|
|
|
|
e.queue = self
|
|
|
|
e.queue = self
|
|
|
|
raise e
|
|
|
|
raise e
|
|
|
|
return job
|
|
|
|
return job
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def dequeue_any(cls, queues, timeout, connection=None):
|
|
|
|
def dequeue_any(cls, queues, timeout, connection=None):
|
|
|
|