--autoreload does not work with amqp
I can get --autoreload to work with the django-celery database backend, but when I try the same configuration with AMQP, the worker processes don't get the new code.
Trying to debug, I put code into tasks.py to print out the current PID:
import os
print 'outside task, pid %s' % os.getpid()
@task(ignore_result=True)
def test(*args, **kwargs):
print 'inside task, version 1, pid %s' % os.getpid()
When I start the server using BROKER_URL = "django://" and then edit the version string, I see console output indicating that the 'outside' line has been executed on two different processes, ie the main process and the worker.
[2012-12-17 22:49:11,979: INFO/MainProcess] Detected modified modules: ['mysite.tasks']
[2012-12-17 22:49:11,983: WARNING/MainProcess] outside task, pid 36739
[2012-12-17 22:49:14,707: WARNING/PoolWorker-4] outside task, pid 36760
When I switch to AMQP and edit the code after start-up, I only see the log entry from the main process. The worker does get a new PID, but it never executes the 'outside' line. When that task is fired, it uses the original version of the code.
[2012-12-17 22:50:23,754: INFO/MainProcess] Detected modified modules: ['fanmgmt.task_scheduler.fun_test_tasks']
[2012-12-17 22:50:23,759: WARNING/MainProcess] outside task, pid 36782
This is in a brand-new empty Django 1.4.2 project using celery/django-celery 3.0.11.
That is to be expected as the child process will have inherited the module from the parent process.
The django:// transport used execv() which will mean it did not inherit the memory of the parent.