本文整理汇总了Python中SolrClient.IndexQ.get_todo_items方法的典型用法代码示例。如果您正苦于以下问题:Python IndexQ.get_todo_items方法的具体用法?Python IndexQ.get_todo_items怎么用?Python IndexQ.get_todo_items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolrClient.IndexQ
的用法示例。
在下文中一共展示了IndexQ.get_todo_items方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_locking
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_todo_items [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))
示例2: test_dequeue
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_todo_items [as 别名]
def test_dequeue(self):
size = 1
files = 2
index = IndexQ(test_config['indexqbase'], 'testq', size=size)
buff = []
docs = []
for _ in range(files):
doc = index.add(self.docs,finalize=True)
docs.append(doc)
index = IndexQ(test_config['indexqbase'], 'testq')
indexdocs = []
for x in index.get_todo_items():
indexdocs.append(x)
self.assertEqual(docs,indexdocs)
[os.remove(doc) for doc in docs]
示例3: test_dequeue_100
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_todo_items [as 别名]
def test_dequeue_100(self):
size = 1
files = 100
rdocs = self.rand_docs.get_docs(500)
index = IndexQ(test_config['indexqbase'], 'testq', size=size)
buff = []
docs = []
for dir in ['_todo_dir','_done_dir']:
[os.remove(x) for x in index.get_all_as_list(dir=dir)]
for _ in range(files):
doc = index.add(rdocs,finalize=True)
docs.append(doc)
index = IndexQ(test_config['indexqbase'], 'testq')
indexdocs = []
for x in index.get_todo_items():
indexdocs.append(x)
self.assertEqual(docs,indexdocs)
[os.remove(doc) for doc in docs]
示例4: test_dequeue_and_complete_no_compression_5
# 需要导入模块: from SolrClient import IndexQ [as 别名]
# 或者: from SolrClient.IndexQ import get_todo_items [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]