Problem:
1. A task has a top-level variable, whose value is 1 at first
2. After run once by celery, the value is changed to 2
3. When running task with celery for the second time, you will see the value is still 1 !
That’s because the the worker running for the first time is not the one who runs for the second time. They are different processes!
You need to keep this in mind, and put the global states in a database or something.