reload tasks automatically

970 views
Skip to first unread message

mike

unread,
Jul 25, 2010, 11:32:51 AM7/25/10
to celery-users
Hi,

I'm probably missing something obvious but I'm wondering if there's a
way to automatically reload tasks when the source changes? I'm using
celery in a django app, starting it with a supervisord script with the
command:

/path/manage.py celeryd --loglevel=INFO

I have to reload or restart it every time I change the source code. Is
there some way I can make it auto reload tasks when in development?

Thanks very much for any advice,
Mike

Ask Solem

unread,
Aug 2, 2010, 10:06:55 AM8/2/10
to celery...@googlegroups.com

Celery does not support code reloading.

Apparently reloading code in Python is *very* tricky to get right,
and in some situations probably impossible.

If someone want to hack on this it will be appreciated,
but I'm guessing it may be rather pointless if it doesn't work
in production anyway.

--
{Ask Solem,
+47 98435213 | twitter.com/asksol }.

fredj

unread,
Aug 3, 2010, 5:20:09 AM8/3/10
to celery-users
Hello,
You can try to hack something with nosier [1]: it allows you to run an
arbitrary command when a file change in a directory (recursively).
Only works with linux >= 2.6.

See also the paste.reloader [2] from the Python Paste project

fredj

[1] http://pypi.python.org/pypi/nosier
[2] http://pythonpaste.org/modules/reloader.html

mike

unread,
Aug 3, 2010, 12:43:34 PM8/3/10
to celery-users
Thank you both for your responses.

nosier is working well for me. Running it like:

sudo /home/mike/env/wepub/bin/nosier "supervisorctl reload" /home/mike/
work/wepub/tasks.py

Then I tail the log. Makes me very happy. Still kind of a long wait
between saving and being able to re-run the test but at least I don't
have to much around on the command line each time.

Thanks!

-Mike

mike

unread,
Aug 3, 2010, 12:44:24 PM8/3/10
to celery-users
I meant "rerun the task" not "test". -Mike
Reply all
Reply to author
Forward
0 new messages