def open(self, configuration=None, create=False): if configuration: self.configuration = configuration self.data_store = load_from_settings(self.configuration) if create: self.data_store.create() return VALID_STORE
def set_up_cassandra(self): host_list = '["localhost:9160"]' keyspace = 'agamemnontests' try: cassandra.drop_keyspace(host_list, keyspace) except Exception: pass cassandra.create_keyspace(host_list, keyspace) self.ds = load_from_settings({ 'agamemnon.host_list': host_list, "agamemnon.keyspace": keyspace })
def setup(self, app): """ Initialize the agamemnon datastore. Parameters: - app: the application into which this plugin is being loaded. Returns: None """ for other in app.plugins: if not isinstance(other, AgamemnonPlugin): continue if other.keyword == self.keyword: raise PluginError("Found another agamemnon plugins with "\ "same keyword") if self.datastore is None: self.datastore = load_from_settings(self.settings)
def open(self, configuration=None, create=False, repl_factor = 1): if configuration: self._process_config(configuration) keyspace = self.configuration['agamemnon.keyspace'] if create and keyspace != "memory": hostlist = json.loads(self.configuration['agamemnon.host_list']) system_manager = pycassa.SystemManager(hostlist[0]) try: log.info("Attempting to drop keyspace: %s" % keyspace) system_manager.drop_keyspace(keyspace) except pycassa.cassandra.ttypes.InvalidRequestException: log.warn("Keyspace didn't exist") finally: log.info("Creating keyspace: %s" % keyspace) system_manager.create_keyspace(keyspace, replication_factor=repl_factor) self.data_store = load_from_settings(self.configuration) return VALID_STORE
def set_up_in_memory(self): self.ds = load_from_settings({'agamemnon.keyspace': 'memory'})