diff options
author | Palaparthy Adityachandra | 2020-05-18 16:28:00 +0530 |
---|---|---|
committer | GitHub | 2020-05-18 16:28:00 +0530 |
commit | 50fec4b15da116fe8af05aa4583d56af27955679 (patch) | |
tree | fe431506e3a89d854f8d0b24e811ca6d6129206a /online_test/celery.py | |
parent | 2db15ac584ae991cd052fa0eed68194594f91775 (diff) | |
parent | f7825eade425cb51ba053763db9d9fd051b0f4ce (diff) | |
download | online_test-50fec4b15da116fe8af05aa4583d56af27955679.tar.gz online_test-50fec4b15da116fe8af05aa4583d56af27955679.tar.bz2 online_test-50fec4b15da116fe8af05aa4583d56af27955679.zip |
Merge pull request #692 from adityacp/merge_monitor_regrade
Merge monitor regrade
Diffstat (limited to 'online_test/celery.py')
-rw-r--r-- | online_test/celery.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/online_test/celery.py b/online_test/celery.py new file mode 100644 index 0000000..6868b89 --- /dev/null +++ b/online_test/celery.py @@ -0,0 +1,25 @@ +from __future__ import absolute_import, unicode_literals + +import os +from django.conf import settings +from celery import Celery + +# set the default Django settings module for the 'celery' program. +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'online_test.settings') + +app = Celery('online_test') + +# Using a string here means the worker doesn't have to serialize +# the configuration object to child processes. +# - namespace='CELERY' means all celery-related configuration keys +# should have a `CELERY_` prefix. +app.config_from_object('django.conf:settings', namespace='CELERY') + +# Load task modules from all registered Django app configs. +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) + +@app.task(name='celery.ping') +def ping(): + # type: () -> str + """Simple task that just returns 'pong'.""" + return 'pong' |