diff --git a/django_q/brokers/__init__.py b/django_q/brokers/__init__.py index 1de452b..47e55e8 100644 --- a/django_q/brokers/__init__.py +++ b/django_q/brokers/__init__.py @@ -62,6 +62,12 @@ class Broker(object): """ pass + def info(self): + """ + Shows the broker type + """ + pass + def set_stat(self, key, value, timeout): """ Saves a cluster statistic to the cache provider diff --git a/django_q/brokers/aws_sqs.py b/django_q/brokers/aws_sqs.py index fd01070..12844ac 100644 --- a/django_q/brokers/aws_sqs.py +++ b/django_q/brokers/aws_sqs.py @@ -46,6 +46,9 @@ class Sqs(Broker): except Exception as e: raise e + def info(self): + return 'AWS SQS' + @staticmethod def get_connection(list_key=Conf.PREFIX): conn = boto.sqs.connect_to_region(Conf.SQS['region'], diff --git a/django_q/brokers/disque.py b/django_q/brokers/disque.py index b274e1f..d763d87 100644 --- a/django_q/brokers/disque.py +++ b/django_q/brokers/disque.py @@ -32,6 +32,10 @@ class Disque(Broker): if jobs: self.connection.execute_command('DELJOB {}'.format(' '.join(map(str, jobs)))) + def info(self): + info = self.connection.info('server') + return 'Disque {}'.format(info['disque_version']) + @staticmethod def get_connection(list_key=Conf.PREFIX): # randomize nodes diff --git a/django_q/brokers/iron_mq.py b/django_q/brokers/iron_mq.py index 9fbc79d..57cac5a 100644 --- a/django_q/brokers/iron_mq.py +++ b/django_q/brokers/iron_mq.py @@ -17,6 +17,9 @@ class IronMQBroker(Broker): def ping(self): return self.connection.name == self.list_key + def info(self): + return 'IronMQ' + def queue_size(self): return self.connection.size() diff --git a/django_q/brokers/redis_broker.py b/django_q/brokers/redis_broker.py index 6f57567..8ef157c 100644 --- a/django_q/brokers/redis_broker.py +++ b/django_q/brokers/redis_broker.py @@ -34,6 +34,10 @@ class Redis(Broker): logger.error('Can not connect to Redis server.') raise e + def info(self): + info = self.connection.info('server') + return 'Redis {}'.format(info['redis_version']) + def set_stat(self, key, value, timeout): self.connection.set(key, value, timeout)