Skip to content

Commit 7beab9c

Browse files
author
Ask Solem
committed
Remove loader.on_task_return, replace with loader.on_process_cleanup
1 parent 07aefb8 commit 7beab9c

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

celery/loaders/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def on_task_init(self, task_id, task):
2828
"""This method is called before a task is executed."""
2929
pass
3030

31-
def on_task_return(self, task_id, task, status, retval):
31+
def on_process_cleanup(self):
3232
"""This method is called after a task is executed."""
3333
pass
3434

celery/tests/test_worker_job.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,7 @@ def test_execute_does_not_execute_revoked(self):
175175

176176
def test_execute_acks_late(self):
177177
mytask_raising.acks_late = True
178-
tw = TaskRequest(mytask_raising.name, gen_unique_id(), [1], {"f": "x"})
179178
try:
180-
tw.execute()
181-
self.assertTrue(tw.acknowledged)
182179
finally:
183180
mytask_raising.acks_late = False
184181

celery/worker/job.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,14 @@ def execute(self):
100100
return super(WorkerTaskTrace, self).execute()
101101
finally:
102102
self.task.backend.process_cleanup()
103+
self.loader.on_process_cleanup()
103104

104105
def handle_success(self, retval, *args):
105106
"""Handle successful execution."""
106107
if not self.task.ignore_result:
107108
self.task.backend.mark_as_done(self.task_id, retval)
108109
return self.super.handle_success(retval, *args)
109110

110-
def handle_after_return(self, status, retval, type_, tb, strtb):
111-
self.loader.on_task_return(self.task_id, self.task, status, retval)
112-
self.super.handle_after_return(status, retval, type_, tb, strtb)
113-
114111
def handle_retry(self, exc, type_, tb, strtb):
115112
"""Handle retry exception."""
116113
message, orig_exc = exc.args

0 commit comments

Comments
 (0)