summaryrefslogtreecommitdiff
path: root/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'tasks.py')
-rw-r--r--tasks.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tasks.py b/tasks.py
index 182a9d3..e65a256 100644
--- a/tasks.py
+++ b/tasks.py
@@ -1,11 +1,26 @@
+import logging
+
from celery import Celery
+from celery.schedules import crontab
celery = Celery('tasks', broker='redis://localhost')
+CELERYBEAT_SCHEDULE = {
+ 'every-ten-secs': {
+ 'task': 'tasks.print_fib',
+ 'schedule': crontab(minute='*/1'),
+ 'args': (30),
+ },
+}
+
-@celery.task
def fib(n):
if n > 1:
return fib(n - 1) + fib(n - 2)
else:
return 1
+
+
+@celery.task
+def print_fib(n):
+ logging.info(fib(n))