summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--requirements.txt12
-rw-r--r--runtime.txt1
-rw-r--r--tasks.py13
3 files changed, 16 insertions, 10 deletions
diff --git a/requirements.txt b/requirements.txt
index 5f0186a..ad5180e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
-amqp==1.3.3
+amqp==1.4.6
anyjson==0.3.3
-billiard==3.3.0.7
-celery==3.1.4
-kombu==3.0.5
-pytz==2013.8
-redis==2.8.0
+billiard==3.3.0.19
+celery==3.1.17
+kombu==3.0.24
+pytz==2014.10
+redis==2.10.3
diff --git a/runtime.txt b/runtime.txt
new file mode 100644
index 0000000..bc42bd0
--- /dev/null
+++ b/runtime.txt
@@ -0,0 +1 @@
+python-3.4.2
diff --git a/tasks.py b/tasks.py
index fa6b143..81cbda6 100644
--- a/tasks.py
+++ b/tasks.py
@@ -1,7 +1,6 @@
import logging
-from celery import Celery
-from celery.task import periodic_task
+from celery import Celery, task
from datetime import timedelta
from os import environ
@@ -15,7 +14,13 @@ app = Celery('tasks')
app.conf.update(
BROKER_URL=REDIS_URL,
CELERY_TASK_SERIALIZER='json',
- CELERY_ACCEPT_CONTENT=['json', 'msgpack', 'yaml']
+ CELERY_ACCEPT_CONTENT=['json'],
+ CELERYBEAT_SCHEDULE = {
+ 'print-fibonacci': {
+ 'task': 'tasks.print_fib',
+ 'schedule': timedelta(seconds=10)
+ },
+ }
)
# Define the fibonacci function for use in our task
@@ -26,7 +31,7 @@ def fib(n):
return 1
# The periodic task itself, defined by the following decorator
-@periodic_task(run_every=timedelta(seconds=10))
+@task
def print_fib():
# Just log fibonacci(30), no more
logging.info(fib(30))