Mercurial > public > sg101
annotate custom_search/tasks.py @ 937:89e2d00d653c
Add tests for weblinks signal handlers.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 26 Apr 2015 13:59:03 -0500 |
parents | f97dd33ca52d |
children |
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@755 | 8 from celery.utils.log import get_task_logger |
bgneal@726 | 9 from django.conf import settings |
bgneal@525 | 10 |
bgneal@525 | 11 from queued_search.management.commands.process_search_queue import Command |
bgneal@525 | 12 |
bgneal@755 | 13 logger = get_task_logger(__name__) |
bgneal@755 | 14 |
bgneal@525 | 15 |
bgneal@750 | 16 @shared_task |
bgneal@525 | 17 def process_search_queue_task(): |
bgneal@525 | 18 """ |
bgneal@525 | 19 Celery task to run the queued_search application's process_search_queue |
bgneal@525 | 20 command. |
bgneal@525 | 21 |
bgneal@525 | 22 """ |
bgneal@726 | 23 if settings.SEARCH_QUEUE_ENABLED: |
bgneal@726 | 24 command = Command() |
bgneal@726 | 25 command.execute() |
bgneal@726 | 26 else: |
bgneal@726 | 27 logger.warning("Search queue disabled; skipping processing") |