|
|
@ -236,6 +236,7 @@ class TestWorker(RQTestCase):
|
|
|
|
self.assertEqual(job.is_failed, True)
|
|
|
|
self.assertEqual(job.is_failed, True)
|
|
|
|
|
|
|
|
|
|
|
|
def test_job_dependency(self):
|
|
|
|
def test_job_dependency(self):
|
|
|
|
|
|
|
|
"""Waitlisted jobs are enqueued only if their parents don't fail"""
|
|
|
|
q = Queue()
|
|
|
|
q = Queue()
|
|
|
|
w = Worker([q])
|
|
|
|
w = Worker([q])
|
|
|
|
parent_job = q.enqueue(say_hello)
|
|
|
|
parent_job = q.enqueue(say_hello)
|
|
|
@ -243,3 +244,9 @@ class TestWorker(RQTestCase):
|
|
|
|
w.work(burst=True)
|
|
|
|
w.work(burst=True)
|
|
|
|
job = Job.fetch(job.id)
|
|
|
|
job = Job.fetch(job.id)
|
|
|
|
self.assertEqual(job.status, 'finished')
|
|
|
|
self.assertEqual(job.status, 'finished')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parent_job = q.enqueue(div_by_zero)
|
|
|
|
|
|
|
|
job = q.enqueue_call(say_hello, after=parent_job)
|
|
|
|
|
|
|
|
w.work(burst=True)
|
|
|
|
|
|
|
|
job = Job.fetch(job.id)
|
|
|
|
|
|
|
|
self.assertNotEqual(job.status, 'finished')
|
|
|
|