225d31587eeb9aca226158e346c8e9730777913c,perfkitbenchmarker/publisher.py,,RepublishJSONSamples,#Any#,763

Before Change


      try:
        raw_dict = json.loads(line)
        labels = raw_dict.pop("labels")
        metadata = dict()
        // labels is a comma-seprated list of key, value pairs
        for pair in labels.split(","):
          // Need to strip leading and trailing "|" from each pair
          key, _, value = pair[1:-1].partition(":")
          metadata[key] = value
        raw_dict["metadata"] = metadata
        samples.append(raw_dict)
      except Exception as e:
        logging.info("Exception processing sample %s", line)

After Change


    samples = [json.loads(s) for s in file if s]
  for sample in samples:
    // Chop "|" at the beginning and end of labels and split labels by "|,|"
    fields = sample.pop("labels")[1:-1].split("|,|")
    // Turn the fields into [[key, value], ...]
    key_values = [field.split(":", 1) for field in fields]
    sample["metadata"] = {k: v for k, v in key_values}

  // We can"t use a SampleCollector because SampleCollector.AddSamples depends on
  // having a benchmark and a benchmark_spec.
  publishers = SampleCollector._PublishersFromFlags()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 225d31587eeb9aca226158e346c8e9730777913c
Time: 2017-02-24
Author: nlavine@google.com
File Name: perfkitbenchmarker/publisher.py
Class Name:
Method Name: RepublishJSONSamples


Project Name: pantsbuild/pants
Commit Name: 39a57d699153b9fea87d7922c999a1c07c3f5173
Time: 2014-02-21
Author: jsirois@twitter.com
File Name: src/python/twitter/pants/tasks/builddictionary.py
Class Name: BuildBuildDictionary
Method Name: _gen_goals_reference


Project Name: pantsbuild/pants
Commit Name: e231c3060cc377553c5668aadd873c3a5fd6fa6c
Time: 2014-02-20
Author: lhosken@twitter.com
File Name: src/python/twitter/pants/tasks/builddictionary.py
Class Name: BuildBuildDictionary
Method Name: _gen_goals_reference