本文整理汇总了Python中moztelemetry.dataset.Dataset.summaries方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.summaries方法的具体用法?Python Dataset.summaries怎么用?Python Dataset.summaries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moztelemetry.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.summaries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scan_multiple_where_params
# 需要导入模块: from moztelemetry.dataset import Dataset [as 别名]
# 或者: from moztelemetry.dataset.Dataset import summaries [as 别名]
def test_scan_multiple_where_params(spark_context):
bucket_name = 'test-bucket'
store = InMemoryStore(bucket_name)
store.store['dir1/subdir1/key1'] = 'value1'
store.store['dir1/another-dir/key2'] = 'value2'
dataset = Dataset(bucket_name, ['dim1', 'dim2'], store=store).where(dim1='dir1', dim2='subdir1')
summaries = dataset.summaries(spark_context)
expected_key = 'dir1/subdir1/key1'
assert summaries == [{'key': expected_key, 'size': len(store.store[expected_key])}]
示例2: test_summaries_with_limit
# 需要导入模块: from moztelemetry.dataset import Dataset [as 别名]
# 或者: from moztelemetry.dataset.Dataset import summaries [as 别名]
def test_summaries_with_limit(spark_context):
bucket_name = 'test-bucket'
store = InMemoryStore(bucket_name)
store.store['dir1/subdir1/key1'] = 'value1'
store.store['dir2/subdir2/key2'] = 'value2'
dataset = Dataset(bucket_name, ['dim1', 'dim2'], store=store, max_concurrency=1)
summaries = dataset.summaries(spark_context, 1)
assert len(summaries) == 1
assert summaries[0]['key'] in store.store
示例3: test_summaries
# 需要导入模块: from moztelemetry.dataset import Dataset [as 别名]
# 或者: from moztelemetry.dataset.Dataset import summaries [as 别名]
def test_summaries(spark_context):
bucket_name = 'test-bucket'
store = InMemoryStore(bucket_name)
store.store['dir1/subdir1/key1'] = 'value1'
store.store['dir2/subdir2/key2'] = 'value2'
dataset = Dataset(bucket_name, ['dim1', 'dim2'], store=store, max_concurrency=1)
summaries = dataset.summaries(spark_context)
assert len(summaries) == 2
for item in summaries:
assert item['key'] in store.store
assert item['size'] == len(store.store[item['key']])
示例4: test_prefix_slash
# 需要导入模块: from moztelemetry.dataset import Dataset [as 别名]
# 或者: from moztelemetry.dataset.Dataset import summaries [as 别名]
def test_prefix_slash(spark_context):
bucket_name = 'test-bucket'
store = InMemoryStore(bucket_name)
store.store['a/b/dir1/subdir1/key1'] = 'value1'
store.store['a/b/dir2/subdir2/key2'] = 'value2'
store.store['x/b/dir3/subdir3/key3'] = 'value3'
store.store['a/c/dir4/subdir4/key4'] = 'value4'
dataset = Dataset(bucket_name, ['dim1', 'dim2'], store=store, prefix='a/b', max_concurrency=1)
summaries = dataset.summaries(spark_context)
assert len(summaries) == 2
for item in summaries:
assert item['key'] in store.store
assert item['size'] == len(store.store[item['key']])
# be sure "where" still works
summaries_filtered = dataset.where(dim1='dir1').summaries(spark_context)
assert len(summaries_filtered) == 1
assert summaries_filtered[0]['key'] == 'a/b/dir1/subdir1/key1'