Permalink
Browse files

Adding celeryd

Sample task set up and running periodically when you run "python manage.py celeryd -B".
Also visible in admin.... Need to find the results though... :-/
  • Loading branch information...
1 parent 0f35116 commit d11755868c7c359d1f3772da9b627a0a6c50fba0 Dustin Chesterman committed Feb 28, 2012
Showing with 40 additions and 5 deletions.
  1. +27 −5 rebootourschools/settings.py
  2. +6 −0 rebootourschools/technologytrackerapi/tasks.py
  3. +7 −0 requirements.txt
@@ -2,7 +2,8 @@
#IMPORTS
import os
-#import djcelery
+import djcelery
+from datetime import timedelta
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -115,6 +116,28 @@
os.getcwd() + '/templates',
)
+
+# CELERY STUFF
+djcelery.setup_loader()
+BROKER_URL = "django://"
+BROKER_HOST = "localhost"
+BROKER_PORT = 5672
+BROKER_USER = "guest"
+BROKER_PASSWORD = "guest"
+BROKER_VHOST = "/"
+CELERYD_CONCURRENCY = "1"
+CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
+
+
+CELERYBEAT_SCHEDULE = {
+ "runs-every-30-seconds": {
+ "task": "technologytrackerapi.tasks.add",
+ "schedule": timedelta(seconds=5),
+ "args": (16, 16)
+ },
+}
+
+
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -123,9 +146,11 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'technologytracker',
+ 'technologytrackerapi',
'django.contrib.admin',
- # 'djcelery',
+ 'djcelery',
'django.contrib.admindocs',
+ 'kombu.transport.django',
)
# A sample logging configuration. The only tangible logging
@@ -155,6 +180,3 @@
from settings_dev import *
except ImportError, exp:
pass
-
-#CELERY LOADER
-#djcelery.setup_loader()
@@ -0,0 +1,6 @@
+from celery.decorators import task
+
+@task()
+def add(x, y):
+ return x + y
+
View
@@ -1,6 +1,13 @@
Django==1.3.1
+amqplib==1.0.2
+anyjson==0.3.1
+celery==2.5.0
distribute==0.6.24
+django-celery==2.5.0
+django-picklefield==0.2.0
docutils==0.8.1
+kombu==2.1.1
psycopg2==2.4.4
+python-dateutil==1.5
wsgiref==0.1.2
yolk==0.4.3

0 comments on commit d117558

Please sign in to comment.