本文整理匯總了Python中SolrClient.SolrClient.get_zk方法的典型用法代碼示例。如果您正苦於以下問題:Python SolrClient.get_zk方法的具體用法?Python SolrClient.get_zk怎麽用?Python SolrClient.get_zk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SolrClient.SolrClient
的用法示例。
在下文中一共展示了SolrClient.get_zk方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ZKTest
# 需要導入模塊: from SolrClient import SolrClient [as 別名]
# 或者: from SolrClient.SolrClient import get_zk [as 別名]
class ZKTest(unittest.TestCase):
#High level zk tests
@classmethod
def setUpClass(self):
self.solr = SolrClient(test_config['SOLR_SERVER'][0],
devel=True,
auth=test_config['SOLR_CREDENTIALS'])
self.rand_docs = RandomTestData()
self.docs = self.rand_docs.get_docs(50)
self.coll = test_config['SOLR_COLLECTION']+str(random.random()*100)
self.temp_dir = test_config['temp_data']
res, con_info = self.solr.collections.api('create', {
'name': self.coll,
'numShards': 1,
'replicationFactor': 1,
'collection.configName': 'basic_configs'
})
sleep(2)
self.zk = self.solr.get_zk()
@classmethod
def tearDownClass(self):
res, con_info = self.solr.collections.api('delete', {'name':self.coll})
def test_zk_get_collection_config_bad_collection(self):
with self.assertRaises(ZookeeperError):
self.zk.download_collection_configs('asdasdasd', self.temp_dir + os.sep + self.coll)
def test_zk_copy_config(self):
a = self.zk.copy_config('basic_configs', 'new_config')
self.assertTrue(self.zk.kz.get('/configs/new_config'))
self.zk.kz.delete('/configs/new_config', recursive=True)
def test_download_collection_configs(self):
# really bad test, need to rework later
a = self.zk.download_collection_configs('basic_configs',
self.temp_dir+'/configs')
self.assertTrue(os.path.isdir(self.temp_dir+'/configs'))
def test_upload_collection_configs(self):
a = self.zk.upload_collection_configs('test1', self.temp_dir+'/configs/basic_configs')
self.zk.kz.delete('/configs/test1', recursive=True)