Example #1
0
 def ensure_defaults(self, alias):
     try:
         conn = self.connections_info[alias]
     except KeyError:
         raise ImproperlyConfigured("The key '%s' isn't an available connection in (%s)." % (alias, ','.join(self.connections_info.keys())))
     
     default_engine = 'signalqueue.worker.backends.RedisSetQueue'
     
     if not conn.get('ENGINE'):
         logg.warn("*** Connection '%s' doesn't specify an ENGINE, using the default engine: '%s'" % default_engine)
         conn['ENGINE'] =  default_engine # default to using the Redis set backend
    def ensure_defaults(self, alias):
        try:
            conn = self.connections_info[alias]
        except KeyError:
            raise ImproperlyConfigured(
                "The key '%s' isn't an available connection in (%s)." %
                (alias, ','.join(self.connections_info.keys())))

        default_engine = 'signalqueue.worker.backends.RedisSetQueue'

        if not conn.get('ENGINE'):
            logg.warn(
                "connection '%s' doesn't specify an ENGINE, using the default engine: '%s'"
                % default_engine)
            # default to using the Redis set backend
            conn['ENGINE'] = default_engine
Example #3
0
 def __init__(self, *args, **kwargs):
     """
     The RedisQueue is the default queue backend. The QueueBase methods are mapped to 
     a Redis list; the redis-py module is required:
     
         https://github.com/andymccurdy/redis-py
     
     Redis is simple and fast, out of the box. The hiredis C library and python wrappers
     can be dropped into your install, to make it faster:
     
         https://github.com/pietern/hiredis-py
     
     To configure Redis, we pass the queue OPTIONS dict off wholesale to the python
     redis constructor -- Simply stick any Redis kwarg options you need into the OPTIONS
     setting. All the redis options can be furthermore specified in the RedisQueue constructor
     as a queue_options dict to override settings.py.
     
     """
     super(RedisQueue, self).__init__(*args, **kwargs)
     
     try:
         import redis
     except ImportError:
         raise IOError("WTF: Can't import redis python module.")
     else:
         try:
             import hiredis
         except ImportError:
             logg.warn("*** Can't import hiredis -- consider installing the 'hiredis' module for native-speed queue access.")
         
         self.r = redis.Redis(**self.queue_options)
         self.ConnectionError = redis.ConnectionError
         
         try:
             self.r.ping()
         except self.ConnectionError, err:
             logg.error("*** Redis connection failed: %s" % err)
             self.r = None
    def __init__(self, *args, **kwargs):
        """
        The RedisQueue is the default queue backend. The QueueBase methods are mapped to 
        a Redis list; the redis-py module is required:
        
            https://github.com/andymccurdy/redis-py
        
        Redis is simple and fast, out of the box. The hiredis C library and python wrappers
        can be dropped into your install, to make it faster:
        
            https://github.com/pietern/hiredis-py
        
        To configure Redis, we pass the queue OPTIONS dict off wholesale to the python
        redis constructor -- Simply stick any Redis kwarg options you need into the OPTIONS
        setting. All the redis options can be furthermore specified in the RedisQueue constructor
        as a queue_options dict to override settings.py.
        
        """
        super(RedisQueue, self).__init__(*args, **kwargs)

        try:
            import redis
        except ImportError:
            raise IOError("WTF: Can't import redis python module.")
        else:
            try:
                import hiredis
            except ImportError:
                logg.warn("can't import the `hiredis` package")
                logg.warn(
                    "consider installing `hiredis` for native-speed access to a Redis queue"
                )
                logg.warn(
                    "you can see the difference even when running the tests --"
                )
                logg.warn("-- it's a good move, trust me on that")

            self.r = redis.Redis(**self.queue_options)
            self.exceptions = (redis.exceptions.ConnectionError,
                               redis.exceptions.DataError,
                               redis.exceptions.InvalidResponse)

            try:
                self.r.ping()
            except self.exceptions, err:
                logg.error("connection to Redis server failed: %s" % err)
                self.r = None
 def __init__(self, *args, **kwargs):
     """
     The RedisQueue is the default queue backend. The QueueBase methods are mapped to 
     a Redis list; the redis-py module is required:
     
         https://github.com/andymccurdy/redis-py
     
     Redis is simple and fast, out of the box. The hiredis C library and python wrappers
     can be dropped into your install, to make it faster:
     
         https://github.com/pietern/hiredis-py
     
     To configure Redis, we pass the queue OPTIONS dict off wholesale to the python
     redis constructor -- Simply stick any Redis kwarg options you need into the OPTIONS
     setting. All the redis options can be furthermore specified in the RedisQueue constructor
     as a queue_options dict to override settings.py.
     
     """
     super(RedisQueue, self).__init__(*args, **kwargs)
     
     try:
         import redis
     except ImportError:
         raise IOError("WTF: Can't import redis python module.")
     else:
         try:
             import hiredis
         except ImportError:
             logg.warn("can't import the `hiredis` package")
             logg.warn("consider installing `hiredis` for native-speed access to a Redis queue")
             logg.warn("you can see the difference even when running the tests --")
             logg.warn("-- it's a good move, trust me on that")
         
         self.r = redis.Redis(**self.queue_options)
         self.exceptions = (
             redis.exceptions.ConnectionError,
             redis.exceptions.DataError,
             redis.exceptions.InvalidResponse)
         
         try:
             self.r.ping()
         except self.exceptions, err:
             logg.error("connection to Redis server failed: %s" % err)
             self.r = None