Celery Best Practices
Celery is the default choice whenever there is a need to introduce a worker queue into Python projects. Not not exactly ideal, but it’s feature-rich, gets the job done, and can be reliable when being used properly. Over the years of working with Celery, I’ve developed certain rules that I would recommend one to follow for building reliable background pipelines. Prefer late acknowledgement In the context of background job queues, acknowledgment is the process of notifying the queue that a particular job has been completed. In most cases it means the job can now be removed from the queue. By default, Celery uses early acknowledgment, meaning the queue is acknowledged as soon as the child worker starts the job. What is the problem here? Well, the worker can simply crash (by receiving a SIGKILL for example) and the task will now be lost without any option to rerun it. ...