当前位置: 首页>>代码示例>>Python>>正文


Python IndexQ.complete方法代码示例

本文整理汇总了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]
开发者ID:hartym,项目名称:SolrClient,代码行数:12,代码来源:test_indexq.py

示例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]
开发者ID:hartym,项目名称:SolrClient,代码行数:15,代码来源:test_indexq.py

示例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]
开发者ID:hartym,项目名称:SolrClient,代码行数:24,代码来源:test_indexq.py

示例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))
开发者ID:hartym,项目名称:SolrClient,代码行数:21,代码来源:test_indexq.py


注:本文中的SolrClient.IndexQ.complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。