Skip to content

Commit 443ef65

Browse files
authored
Fix inconsistency in documentation for link_error (celery#6505)
* Make documentation of link_error consistent Fixes celery#4099 * Fix undefined variable in example * Add to contributors list
1 parent 5529c33 commit 443ef65

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,4 @@ Dipankar Achinta, 2019/10/24
278278
Sardorbek Imomaliev, 2020/01/24
279279
Maksym Shalenyi, 2020/07/30
280280
Frazer McLean, 2020/09/29
281+
Henrik Bruåsdal, 2020/11/29

docs/userguide/calling.rst

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,18 @@ task that adds 16 to the previous result, forming the expression
135135

136136

137137
You can also cause a callback to be applied if task raises an exception
138-
(*errback*), but this behaves differently from a regular callback
139-
in that it will be passed the id of the parent task, not the result.
140-
This is because it may not always be possible to serialize
141-
the exception raised, and so this way the error callback requires
142-
a result backend to be enabled, and the task must retrieve the result
143-
of the task instead.
138+
(*errback*). The worker won't actually call the errback as a task, but will
139+
instead call the errback function directly so that the raw request, exception
140+
and traceback objects can be passed to it.
144141

145142
This is an example error callback:
146143

147144
.. code-block:: python
148145
149146
@app.task
150-
def error_handler(uuid):
151-
result = AsyncResult(uuid)
152-
exc = result.get(propagate=False)
147+
def error_handler(request, exc, traceback):
153148
print('Task {0} raised exception: {1!r}\n{2!r}'.format(
154-
uuid, exc, result.traceback))
149+
request.id, exc, traceback))
155150
156151
it can be added to the task using the ``link_error`` execution
157152
option:

docs/userguide/canvas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ Here's an example errback:
569569
def log_error(request, exc, traceback):
570570
with open(os.path.join('/var/errors', request.id), 'a') as fh:
571571
print('--\n\n{0} {1} {2}'.format(
572-
task_id, exc, traceback), file=fh)
572+
request.id, exc, traceback), file=fh)
573573
574574
To make it even easier to link tasks together there's
575575
a special signature called :class:`~celery.chain` that lets

0 commit comments

Comments
 (0)