Add license headers
[pharos.git] / tools / pharos-dashboard / pharos_dashboard / celery.py
1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10
11 import os
12
13 from celery import Celery
14
15 # set the default Django settings module for the 'celery' program.
16 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pharos_dashboard.settings')
17
18 from django.conf import settings  # noqa
19
20 app = Celery('pharos_dashboard')
21
22 # Using a string here means the worker will not have to
23 # pickle the object when using Windows.
24 app.config_from_object('django.conf:settings')
25 app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
26
27
28 @app.task(bind=True)
29 def debug_task(self):
30     print('Request: {0!r}'.format(self.request))