本文整理汇总了Python中swift.common.middleware.bulk.filter_factory函数的典型用法代码示例。如果您正苦于以下问题:Python filter_factory函数的具体用法?Python filter_factory怎么用?Python filter_factory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_factory函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_delete_concurrency
def test_delete_concurrency(self):
# Must be an integer
conf = {'delete_concurrency': '1.5'}
self.assertRaises(ValueError, bulk.filter_factory, conf)
conf = {'delete_concurrency': 'asdf'}
self.assertRaises(ValueError, bulk.filter_factory, conf)
# Will be at least one
conf = {'delete_concurrency': '-1'}
filter_app = bulk.filter_factory(conf)(FakeApp())
self.assertEqual(1, filter_app.delete_concurrency)
conf = {'delete_concurrency': '0'}
filter_app = bulk.filter_factory(conf)(FakeApp())
self.assertEqual(1, filter_app.delete_concurrency)
# But if you want to set it stupid-high, we won't stop you
conf = {'delete_concurrency': '1000'}
filter_app = bulk.filter_factory(conf)(FakeApp())
self.assertEqual(1000, filter_app.delete_concurrency)
# ...unless it's extra-stupid-high, in which case we cap it
conf = {'delete_concurrency': '1001'}
filter_app = bulk.filter_factory(conf)(FakeApp())
self.assertEqual(1000, filter_app.delete_concurrency)
开发者ID:SmartInfrastructures,项目名称:swift,代码行数:26,代码来源:test_bulk.py
示例2: test_registered_defaults
def test_registered_defaults(self):
bulk.filter_factory({})
swift_info = utils.get_swift_info()
self.assertTrue("bulk_upload" in swift_info)
self.assertTrue(isinstance(swift_info["bulk_upload"].get("max_containers_per_extraction"), numbers.Integral))
self.assertTrue(isinstance(swift_info["bulk_upload"].get("max_failed_extractions"), numbers.Integral))
self.assertTrue("bulk_delete" in swift_info)
self.assertTrue(isinstance(swift_info["bulk_delete"].get("max_deletes_per_request"), numbers.Integral))
self.assertTrue(isinstance(swift_info["bulk_delete"].get("max_failed_deletes"), numbers.Integral))
开发者ID:DmitrySot,项目名称:swift,代码行数:10,代码来源:test_bulk.py
示例3: test_registered_defaults
def test_registered_defaults(self):
bulk.filter_factory({})
swift_info = utils.get_swift_info()
self.assertTrue('bulk_upload' in swift_info)
self.assertTrue(isinstance(
swift_info['bulk_upload'].get('max_containers_per_extraction'),
numbers.Integral))
self.assertTrue(isinstance(
swift_info['bulk_upload'].get('max_failed_extractions'),
numbers.Integral))
self.assertTrue('bulk_delete' in swift_info)
self.assertTrue(isinstance(
swift_info['bulk_delete'].get('max_deletes_per_request'),
numbers.Integral))
self.assertTrue(isinstance(
swift_info['bulk_delete'].get('max_failed_deletes'),
numbers.Integral))
开发者ID:2015-ucsc-hp,项目名称:swift,代码行数:18,代码来源:test_bulk.py
示例4: test_defaults
def test_defaults(self):
expected_defaults = {
'delete_concurrency': 2,
'max_containers': 10000,
'max_deletes_per_request': 10000,
'max_failed_deletes': 1000,
'max_failed_extractions': 1000,
'retry_count': 0,
'retry_interval': 1.5,
'yield_frequency': 10,
}
filter_app = bulk.filter_factory({})(FakeApp())
self.assertEqual(expected_defaults, {k: getattr(filter_app, k)
for k in expected_defaults})
filter_app = bulk.Bulk(FakeApp(), None)
self.assertEqual(expected_defaults, {k: getattr(filter_app, k)
for k in expected_defaults})
开发者ID:SmartInfrastructures,项目名称:swift,代码行数:19,代码来源:test_bulk.py
示例5: setUp
def setUp(self):
self.app = FakeApp()
self.bulk = bulk.filter_factory({})(self.app)
开发者ID:2015-ucsc-hp,项目名称:swift,代码行数:3,代码来源:test_bulk.py
示例6: setUp
def setUp(self):
self.app = FakeApp()
self.bulk = bulk.filter_factory({})(self.app)
self.testdir = os.path.join(mkdtemp(), 'tmp_test_bulk')
os.mkdir(self.testdir)
开发者ID:ArikaChen,项目名称:swift,代码行数:5,代码来源:test_bulk.py
示例7: setUp
def setUp(self):
self.app = FakeSwift()
self.bulk = bulk.filter_factory({})(self.app)
self.testdir = mkdtemp(suffix="tmp_test_bulk")
开发者ID:DmitrySot,项目名称:swift,代码行数:4,代码来源:test_bulk.py
示例8: setUp
def setUp(self):
self.app = FakeApp()
self.bulk = bulk.filter_factory(self.conf)(self.app)
self.bulk.logger = debug_logger()
开发者ID:mahak,项目名称:swift,代码行数:4,代码来源:test_bulk.py
注:本文中的swift.common.middleware.bulk.filter_factory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论