Mercurial > public > sg101
annotate custom_search/tasks.py @ 750:aeafbf3ecebf
For #63, upgrade to celery 3.1.7.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 31 Dec 2013 16:36:22 -0600 |
parents | f0b997651497 |
children | f97dd33ca52d |
rev | line source |
---|---|
bgneal@525 | 1 """ |
bgneal@525 | 2 Tasks for our custom search application. |
bgneal@525 | 3 |
bgneal@525 | 4 """ |
bgneal@750 | 5 from __future__ import absolute_import |
bgneal@750 | 6 |
bgneal@750 | 7 from celery import shared_task |
bgneal@726 | 8 from django.conf import settings |
bgneal@525 | 9 |
bgneal@525 | 10 from queued_search.management.commands.process_search_queue import Command |
bgneal@525 | 11 |
bgneal@525 | 12 |
bgneal@750 | 13 @shared_task |
bgneal@525 | 14 def process_search_queue_task(): |
bgneal@525 | 15 """ |
bgneal@525 | 16 Celery task to run the queued_search application's process_search_queue |
bgneal@525 | 17 command. |
bgneal@525 | 18 |
bgneal@525 | 19 """ |
bgneal@726 | 20 if settings.SEARCH_QUEUE_ENABLED: |
bgneal@726 | 21 command = Command() |
bgneal@726 | 22 command.execute() |
bgneal@726 | 23 else: |
bgneal@726 | 24 logger = process_search_queue_task.get_logger() |
bgneal@726 | 25 logger.warning("Search queue disabled; skipping processing") |