本文整理汇总了Python中SolrClient.IndexQ.complete方法的典型用法代码示例。如果您正苦于以下问题:Python IndexQ.complete方法的具体用法?Python IndexQ.complete怎么用?Python IndexQ.complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolrClient.IndexQ
的用法示例。
在下文中一共展示了IndexQ.complete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_complete_compress_basic
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import complete [as 别名]
def test_complete_compress_basic(self):
log = logging.getLogger()
index = IndexQ(test_config['indexqbase'], 'testq', size = 1, log = log,
compress=True)
for item in self.docs[1:10]:
index.add(item, finalize=True)
files = []
for item in index.get_all_as_list():
files.append(index.complete(item))
[self.assertTrue(os.path.exists(x)) for x in files]
示例2: test_complete_dir_rotate
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import complete [as 别名]
def test_complete_dir_rotate(self):
log = logging.getLogger()
rotate_func = lambda: '{}/{}/{}'.format(dt.now().year, dt.now().month, dt.now().day)
index = IndexQ(test_config['indexqbase'], 'testq', size = 1, log = log,
rotate_complete = rotate_func)
dir_set = rotate_func()
docs = self.rand_docs.get_docs(69)
for item in self.docs[1:10]:
index.add(item, finalize=True)
files = []
for item in index.get_all_as_list():
files.append(index.complete(item))
[self.assertTrue(os.path.exists(x)) for x in files]
示例3: test_dequeue_and_complete_no_compression_5
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import complete [as 别名]
def test_dequeue_and_complete_no_compression_5(self):
size = 1
files = 5
index = IndexQ(test_config['indexqbase'], 'testq', size=size)
buff = []
docs = []
for _ in range(files):
doc = index.add(self.docs,finalize=True)
sleep(1)
docs.append(doc)
index = IndexQ(test_config['indexqbase'], 'testq', compress=False)
indexdocs = []
for x in index.get_todo_items():
indexdocs.append(x)
index.complete(x)
self.assertEqual(docs,indexdocs)
finaldocnames = [os.path.split(x)[-1] for x in indexdocs]
donefilepaths = [os.path.join(index._done_dir,x) for x in finaldocnames]
for x in donefilepaths:
self.assertTrue(os.path.exists(x))
[os.remove(doc) for doc in donefilepaths]
示例4: test_locking
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import complete [as 别名]
def test_locking(self):
'''
Working on this one, it doesn't lock properly
'''
files = 5
index = IndexQ(test_config['indexqbase'], 'testq')
buff = []
docs = []
for _ in range(files):
doc = index.add(self.docs,finalize=True)
docs.append(doc)
index = IndexQ(test_config['indexqbase'], 'testq', mode='out',devel=True)
x = index.get_todo_items()
self.assertTrue(os.path.exists(index._lck))
with self.assertRaises(RuntimeError) as a:
new_index = IndexQ(test_config['indexqbase'], 'testq', mode='out')
y = new_index.get_todo_items()
[index.complete(i) for i in x]
self.assertFalse(os.path.exists(index._lck))