view custom_search/tasks.py @ 753:ad53d929281a

For issue #62, upgrade Haystack from 1.2.7 to 2.1.0.
author Brian Neal <bgneal@gmail.com>
date Fri, 03 Jan 2014 19:01:18 -0600
parents aeafbf3ecebf
children f97dd33ca52d
line wrap: on
line source
"""
Tasks for our custom search application.

"""
from __future__ import absolute_import

from celery import shared_task
from django.conf import settings

from queued_search.management.commands.process_search_queue import Command


@shared_task
def process_search_queue_task():
    """
    Celery task to run the queued_search application's process_search_queue
    command.

    """
    if settings.SEARCH_QUEUE_ENABLED:
        command = Command()
        command.execute()
    else:
        logger = process_search_queue_task.get_logger()
        logger.warning("Search queue disabled; skipping processing")