def test_get_database(self): db = get_database('python') self.assertTrue(db.ping()) if not NO_REDIS_RUNNING: db = get_database('redis') self.assertTrue(db.ping()) self.assertRaises(NotImplementedError, get_database, 'cobol')
def __init__(self, broker, loop, db='python', dboptions=None, agent_timeout=DEFAULT_AGENT_TIMEOUT): self.broker = broker self.loop = loop # agents registration and timers self._agents = {} self._agent_times = {} self.agent_timeout = agent_timeout self._runs = {} # local DB if dboptions is None: dboptions = {} self._db = get_database(db, self.loop, **dboptions) # cached agents results def default_status(): return {"result": {"status": {}, "command": "STATUS"}} self._cached_status = defaultdict(default_status)
def _init(self): # close any previous connector if self.client is not None: try: self.close() except zmq.ZMQError: pass self.db = get_database(self.backend, **self.dboptions) self.client = Client(self.broker, timeout_max_overflow=20.)
def __init__(self, broker, loop, db='python', dboptions=None, agent_timeout=DEFAULT_TIMEOUT_MOVF): self.broker = broker self.loop = loop # agents registration and timers self._agents = [] self._agent_times = {} self.agent_timeout = agent_timeout self._runs = {} # local DB if dboptions is None: dboptions = {} self._db = get_database(db, self.loop, **dboptions)
def __init__(self): self.db = get_database( settings.LOADS_DATABASE['backend'], **settings.LOADS_DATABASE['options'] ) self.client = Client(settings.LOADS_BROKER)