Mercurial > public > sg101
annotate custom_search/tasks.py @ 726:f0b997651497
For #54, provide a flag to skip search queue processing.
This is useful when we are rebuilding the index.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 22 Sep 2013 12:00:46 -0500 |
parents | ee87ea74d46b |
children | aeafbf3ecebf |
rev | line source |
---|---|
bgneal@525 | 1 """ |
bgneal@525 | 2 Tasks for our custom search application. |
bgneal@525 | 3 |
bgneal@525 | 4 """ |
bgneal@726 | 5 from django.conf import settings |
bgneal@525 | 6 from celery.task import task |
bgneal@525 | 7 |
bgneal@525 | 8 from queued_search.management.commands.process_search_queue import Command |
bgneal@525 | 9 |
bgneal@525 | 10 |
bgneal@525 | 11 @task |
bgneal@525 | 12 def process_search_queue_task(): |
bgneal@525 | 13 """ |
bgneal@525 | 14 Celery task to run the queued_search application's process_search_queue |
bgneal@525 | 15 command. |
bgneal@525 | 16 |
bgneal@525 | 17 """ |
bgneal@726 | 18 if settings.SEARCH_QUEUE_ENABLED: |
bgneal@726 | 19 command = Command() |
bgneal@726 | 20 command.execute() |
bgneal@726 | 21 else: |
bgneal@726 | 22 logger = process_search_queue_task.get_logger() |
bgneal@726 | 23 logger.warning("Search queue disabled; skipping processing") |