I'm kombu/celery setup that I've recently deployed. The tasks execute fine, but appear to run almost continuously rather than respecting the run_every attribute. Perhaps more oddly, this behavior only appears in production and works fine locally.
My tasks.py
looks like this:
from celery.task import PeriodicTask
from datetime import timedelta, datetime
class FirstTask(PeriodicTask):
run_every = timedelta(seconds = 30)
# Do Stuff
My settings.py
includes
BROKER_URL = "django://"
import djcelery
djcelery.setup_loader()
plus 'djcelery'
and 'kombu.transport.django'
in INSTALLED_APPS
.
And in production I run python manage.py celeryd -v 2 -B -s celery -E -l INFO
to start running my tasks. I had been following Chase Seibert's tutorial if that clears anything else up.
How long does the task take to finish? And have you tried clearing your queue before trying it again (celery might not respect the run_every
setting, if you have already tasks in your queue...)