-
-
Notifications
You must be signed in to change notification settings - Fork 5k
result.id is causing celery beat to fail when using transaction.on_commit() #8372
Description
Line 285 in 811ed96
| debug('%s sent. id->%s', entry.task, result.id) |
Reason for asking this question:
We have transaction.on_commit wrapper for out celery tasks which defers the execution of task until the transaction is committed to database. In that case the result returned will be None and celery beat will fail with this error:
[celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message="self.apply_entry(entry, producer=self.producer)" [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message=" File "/lib/python3.8/site-packages/celery/beat.py", line 292, in apply_entry" [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message=" " [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message="debug('%s sent. id->%s', entry.task, result.id)" [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message="AttributeError" [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message=": " [celery.redirected] level=WARNING MainProcess (2023-07-13 09:29:06,184 trace_id="short_id:TEih9A3Q2mEm4J;" [log.write:232] process=96566 thread=8631279104) message="'NoneType' object has no attribute 'id'"
Is there a way using configuration parameter so that we do not end up in this issue or We might need to have a fork just for this change.