diff --git a/rq/registry.py b/rq/registry.py index 25c3bae..eb45682 100644 --- a/rq/registry.py +++ b/rq/registry.py @@ -135,6 +135,7 @@ class StartedJobRegistry(BaseRegistry): job = self.job_class.fetch(job_id, connection=self.connection) job.set_status(JobStatus.FAILED) + job.exc_info = "Moved to FailedJobRegistry at %s" % datetime.now() job.save(pipeline=pipeline, include_meta=False) job.cleanup(ttl=-1, pipeline=pipeline) failed_job_registry.add(job, job.failure_ttl) diff --git a/rq/worker.py b/rq/worker.py index 29ab26d..874640d 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -724,7 +724,7 @@ class Worker(object): self.handle_job_failure( job, - exc_string="Work-horse process was terminated unexpectedly " + exc_string="Work-horse was terminated unexpectedly " "(waitpid returned %s)" % ret_val ) diff --git a/tests/test_registry.py b/tests/test_registry.py index 8938c24..0fb50bc 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -152,6 +152,7 @@ class TestRegistry(RQTestCase): self.assertNotIn(job, self.registry) job.refresh() self.assertEqual(job.get_status(), JobStatus.FAILED) + self.assertTrue(job.exc_info) # explanation is written to exc_info def test_job_execution(self): """Job is removed from StartedJobRegistry after execution."""