def _CreateSamples(ycsb_result, include_histogram=True, **kwargs):
  stage = 'load' if ycsb_result['command_line'].endswith('-load') else 'run'
  base_metadata = {'command_line': ycsb_result['command_line'],
                   'stage': stage}
  base_metadata.update(kwargs)

  for group_name, group in ycsb_result['groups'].iteritems():
    meta = base_metadata.copy()
    meta['operation'] = group_name
    for statistic, value in group['statistics'].iteritems():
      if value is None:
        continue

      unit = ''
      m = re.match(r'^(.*) *\((us|ms|ops/sec)\)$', statistic)
      if m:
        statistic = m.group(1)
        unit = m.group(2)
      yield sample.Sample(' '.join([group_name, statistic]), value, unit, meta)

    if group['histogram']:
      percentiles = _PercentilesFromHistogram(group['histogram'])
      for label, value in percentiles.iteritems():
        yield sample.Sample(' '.join([group_name, label, 'latency']),
                            value, 'ms', meta)

    if include_histogram:
      for time_ms, count in group['histogram']:
        yield sample.Sample(
            '{0}_latency_histogram_{1}_ms'.format(group_name, time_ms),
            count, 'count', meta)
Raise an assertion if there's no elements to return.
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_packages/ycsb.py/_CreateSamples--crossover with--dataset/ETHPy150Open cidles/poio-api/src/poioapi/tests/test_data.py/TestDataStructureType.test_empty_element