Mercurial > public > sg101
annotate custom_search/tasks.py @ 1157:e4f2d6a4b401
Rework S3 connection logic for latest versions of Python 2.7.
Had to make these changes for Ubuntu 16.04. Seems backward compatible
with production.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 19 Jan 2017 18:35:53 -0600 |
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") |