Requeueing job should clear job.exc_info (#1543)

main
Selwin Ong 3 years ago committed by GitHub
parent 63abea1522
commit f9ddf7dca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -231,6 +231,7 @@ class FailedJobRegistry(BaseRegistry):
job_class=self.job_class) job_class=self.job_class)
job.started_at = None job.started_at = None
job.ended_at = None job.ended_at = None
job.exc_info = ''
job.save() job.save()
job = queue.enqueue_job(job, pipeline=pipeline) job = queue.enqueue_job(job, pipeline=pipeline)
pipeline.execute() pipeline.execute()

@ -386,12 +386,10 @@ class TestRQCli(RQTestCase):
prefix = 'Enqueued tests.fixtures.say_hello() with job-id \'' prefix = 'Enqueued tests.fixtures.say_hello() with job-id \''
suffix = '\'.\n' suffix = '\'.\n'
print(result.stdout) self.assertTrue(result.output.startswith(prefix))
self.assertTrue(result.output.endswith(suffix))
self.assertTrue(result.stdout.startswith(prefix)) job_id = result.output[len(prefix):-len(suffix)]
self.assertTrue(result.stdout.endswith(suffix))
job_id = result.stdout[len(prefix):-len(suffix)]
queue_key = 'rq:queue:default' queue_key = 'rq:queue:default'
self.assertEqual(self.connection.llen(queue_key), 1) self.assertEqual(self.connection.llen(queue_key), 1)
self.assertEqual(self.connection.lrange(queue_key, 0, -1)[0].decode('ascii'), job_id) self.assertEqual(self.connection.lrange(queue_key, 0, -1)[0].decode('ascii'), job_id)

@ -357,6 +357,7 @@ class TestFailedJobRegistry(RQTestCase):
self.assertEqual(job.get_status(), JobStatus.QUEUED) self.assertEqual(job.get_status(), JobStatus.QUEUED)
self.assertEqual(job.started_at, None) self.assertEqual(job.started_at, None)
self.assertEqual(job.ended_at, None) self.assertEqual(job.ended_at, None)
self.assertEqual(job.exc_info, '')
worker.work(burst=True) worker.work(burst=True)
self.assertTrue(job in registry) self.assertTrue(job in registry)

Loading…
Cancel
Save