def __init__(self, destination, **kwargs): self._configured = False if kwargs.has_key("config"): self._configure(kwargs["config"]) self._configured = True if kwargs.has_key("loglevel"): log_level = kwargs["loglevel"] elif self._configured is True and self._config.has_option('global', 'log_level'): log_level = self._config.get('global', 'log_level') else: log_level = 'WARN' self.log = logger.LogWrapper(name='vogeler').logger() if kwargs.has_key("dsn"): _dsn = kwargs["dsn"] elif self._configured is True and self._config.has_option('amqp', 'dsn'): _dsn = self._config.get('amqp', 'dsn') else: self.log.fatal("No dsn provided. Cannot continue") try: self.routing_key = destination self.ch = amqp.setup_amqp(_dsn) self.log.info("Vogeler(Runner) is starting up") except Exception, e: msg = "Unable to connect to broker %s" % _dsn self.log.fatal(msg) raise VogelerRunnerException(e)
def __init__(self, destination, **kwargs): try: self.routing_key = destination self.ch = amqp.setup_amqp(kwargs['host'], kwargs['username'], kwargs['password']) log.info("Vogeler(Runner) is starting up") except: raise VogelerRunnerException("Unable to connect to %s as %s" % (kwargs['host'], kwargs['username']) )
def __init__(self, destination, **kwargs): self._configured = False if kwargs.has_key("config"): self._configure(kwargs["config"]) self._configured = True if kwargs.has_key("loglevel"): log_level = kwargs["loglevel"] elif self._configured is True and self._config.has_option( 'global', 'log_level'): log_level = self._config.get('global', 'log_level') else: log_level = 'WARN' self.log = logger.LogWrapper(name='vogeler').logger() if kwargs.has_key("dsn"): _dsn = kwargs["dsn"] elif self._configured is True and self._config.has_option( 'amqp', 'dsn'): _dsn = self._config.get('amqp', 'dsn') else: self.log.fatal("No dsn provided. Cannot continue") try: self.routing_key = destination self.ch = amqp.setup_amqp(_dsn) self.log.info("Vogeler(Runner) is starting up") except Exception, e: msg = "Unable to connect to broker %s" % _dsn self.log.fatal(msg) raise VogelerRunnerException(e)