diff options
author | Seamus Mac Conaonaigh <smaccona@users.noreply.github.com> | 2020-02-27 22:48:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-28 10:48:19 +0700 |
commit | 8f7dbf1b1dc392704e0be42292c8787286d962ad (patch) | |
tree | abd1acc478fa1b6b6cb443b8cf94462df1394668 | |
parent | dc299bc7ec0a60f95266320408ce20e85f1f6105 (diff) | |
download | rq-8f7dbf1b1dc392704e0be42292c8787286d962ad.tar.gz |
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.
-rw-r--r-- | rq/worker.py | 1 |
1 files changed, 1 insertions, 0 deletions
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: |