From 8f7dbf1b1dc392704e0be42292c8787286d962ad Mon Sep 17 00:00:00 2001 From: Seamus Mac Conaonaigh Date: Thu, 27 Feb 2020 22:48:19 -0500 Subject: [PATCH] Pass job ID to error handlers (#1201) The worker handles exceptions in the job outside of the job's own context, so an exception handler / logger cannot call `get_current_job()` to obtain the job ID. The job ID can be used to locate the job in the failed job registry, which allows useful behaviors such as linking to a failed job on a dashboard in an error report. Closes #1192. --- rq/worker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rq/worker.py b/rq/worker.py index edb3a03..271e819 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -933,6 +933,7 @@ class Worker(object): 'arguments': job.args, 'kwargs': job.kwargs, 'queue': job.origin, + 'job_id': job.id, }) for handler in self._exc_handlers: