1

I am running my Django app inside of a docker. I am using a background job as well as a periodic job with Celery + RabbitMQ, running in separate containers from the main app.

Everything works locally with "heroku local".

When running my app on an Ubuntu instance on Digital Ocean, I noticed that the background task and periodic task are executing old versions of my code. Specifically, I removed a field from my Django model last week, and the old code was referencing that deleted field so an error occurs. However, my new code no longer makes any reference to the missing field.

Here are a few things I tried:

  1. rebuild and restart docker (didn't work)
  2. delete all .pyc files (didn't work)
  3. purge all celery tasks (didn't work)
  4. Restart my digital ocean instance (didn't work)
  5. Moving all my code and docker environment to a brand new digital ocean instance. (THIS WORKED!)

I have encountered this problems twice now, and I am hoping to find a better solution than moving to a new machine every time this error happens. I am guessing that Celery or RabbitMQ has cached the old code somewhere that I was not aware of.

Thanks in advance!

Related to this but non of the solutions worked for me: Celery/Rabbitmq/Django - Old tasks being executed without being called in my code

Summer
  • 11
  • 3
  • How are you deploying everything? – Tarun Lalwani Sep 01 '17 at 07:56
  • The reason may have been outdated `*.pyc` files. Can you still reproduce the problem? Because if you can't, it doesn't make much sense to speculate. – Antonis Christofides Sep 01 '17 at 08:56
  • your architecture is unclear - does your containers act like a single celery worker? can you add more info.. – ItayB Sep 01 '17 at 14:52
  • docker-compose.yml has 5 containers 1. web (my app) 2. celery scheduled task 3.celery background task 4. rabbitmq 5.db – Summer Sep 01 '17 at 21:24
  • @AntonisChristofides I have tried deleting all *.pyc files (please see in original question) and that didn't work. I am still having the same problem on my original server box. – Summer Sep 01 '17 at 21:26
  • @TarunLalwani For now just git pull to update the code, rebuild docker and rerun it. – Summer Sep 01 '17 at 21:29

0 Answers0