Reputation: 970
I use celery to process asynchronous tasks.
I understand that when I update the code within these tasks, or When i want to register a new task, then I must restart celery to see the reflection of these changes.
Do I need to restart celery if I update some code, that is within the same file, but not a registered celery task? Are there other reasons on when I should restart celery during a deploy?
Upvotes: 1
Views: 482
Reputation: 3959
When you start a worker process - the whole code is loaded into memory. When a tasks arrives through your broker this code gets executed.
If you change your source code to do somethings else or new, you need to restart the worker, otherwise your changes are not reflected.
It does not make any difference if the source code belongs directly to a task or the code gets executed from within a task. I assume that you are not talking about code that will not be executed in any situation (this would be dead code and you should avoid this).
You should also restart your worker if you update any libraries as the same applies for this code, too.
Upvotes: 4