summaryrefslogtreecommitdiffstats
path: root/pharos-dashboard/pharos_dashboard/celery.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2016-08-19 17:11:58 +0200
committermaxbr <maxbr@mi.fu-berlin.de>2016-08-19 17:11:58 +0200
commita1da09ca6e089913a6aacd5f55051a7f19d6f1fc (patch)
tree2b2a498a4eb0135bc99d03fe0e2aff2d6fbe8ab1 /pharos-dashboard/pharos_dashboard/celery.py
parent79aec84973032e15ae9d36fcbd7d7d42af3283d1 (diff)
Implement periodic tasks
JIRA: RELENG-12 The dashboard is now querying jenkins periodically and saving the results in the database. This fixes delays that were caused by calling the jenkins API. Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'pharos-dashboard/pharos_dashboard/celery.py')
-rw-r--r--pharos-dashboard/pharos_dashboard/celery.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/pharos-dashboard/pharos_dashboard/celery.py b/pharos-dashboard/pharos_dashboard/celery.py
new file mode 100644
index 0000000..4cf6a7a
--- /dev/null
+++ b/pharos-dashboard/pharos_dashboard/celery.py
@@ -0,0 +1,20 @@
+import os
+
+from celery import Celery
+
+# set the default Django settings module for the 'celery' program.
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pharos_dashboard.settings')
+
+from django.conf import settings # noqa
+
+app = Celery('pharos_dashboard')
+
+# Using a string here means the worker will not have to
+# pickle the object when using Windows.
+app.config_from_object('django.conf:settings')
+app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
+
+
+@app.task(bind=True)
+def debug_task(self):
+ print('Request: {0!r}'.format(self.request)) \ No newline at end of file