Esempio n. 1
0
    def __init__(self, queue_name, pipeline_steps = default_tasks):
        """ Init redis pubsub and subscribe to the appropriate channels. 

        Args:
            r (redis.Redis): connected redis instance
            channels (array): string names of channels to which we should subscribe
        """

        self.queue = Queue(queue_name, host=settings.REDIS_HOST, 
            port=settings.REDIS_PORT, password=settings.REDIS_PASSWORD)
        self.queue.serializer = json
        self.db = get_connection()
        self.search_db = get_search_connection()
        self.item_collection = ItemCollection(self.search_db)
        self.pipeline = set_pipeline_steps(pipeline_steps, item_collection=self.item_collection)
Esempio n. 2
0
import importlib
import os.path, pkgutil
import suckas

from datetime import datetime
from qr import Queue
from config import settings
from cn_store_py.connect import get_connection
from cn_search_py.connect import (setup_indexes, get_connection as
                                  get_search_connection)
from cn_search_py.collections import ItemCollection
from bson import objectid

logger = logging.getLogger('suckapy')

db = get_connection()
search_db = get_search_connection()
items = ItemCollection(search_db)

app_queue = Queue(settings.QUEUE_NAME,
                  host=settings.REDIS_HOST,
                  port=settings.REDIS_PORT,
                  password=settings.REDIS_PASSWORD)
transform_queue = Queue(settings.TRANSFORM_QUEUE_NAME,
                        host=settings.REDIS_HOST,
                        port=settings.REDIS_PORT,
                        password=settings.REDIS_PASSWORD)

app_queue.serializer = json
transform_queue.serializer = json
Esempio n. 3
0
import importlib
import os.path, pkgutil
import suckas

from datetime import datetime
from qr import Queue
from config import settings
from cn_store_py.connect import get_connection
from cn_search_py.connect import (setup_indexes, 
    get_connection as get_search_connection)
from cn_search_py.collections import ItemCollection
from bson import objectid

logger = logging.getLogger('suckapy')

db = get_connection()
search_db = get_search_connection()
items = ItemCollection(search_db)

app_queue = Queue(settings.QUEUE_NAME, host=settings.REDIS_HOST, 
            port=settings.REDIS_PORT, password=settings.REDIS_PASSWORD)
transform_queue = Queue(settings.TRANSFORM_QUEUE_NAME, host=settings.REDIS_HOST, 
            port=settings.REDIS_PORT, password=settings.REDIS_PASSWORD)

app_queue.serializer = json
transform_queue.serializer = json

pkgpath = os.path.dirname(suckas.__file__)
sucka_names = [name for _, name, _ in pkgutil.iter_modules([pkgpath])]

def setup_sources(sucka_names):