[Commotion-admin] [mlab-observatory] Adding sample checking module, Telescope data parser (#29)

mtlynch notifications at github.com
Wed Dec 10 11:07:28 EST 2014


> +      raise ValueError('Results must be for download_throughput metric.')
> +
> +    counts_key = self._hash_key_from_metadata(metadata)
> +
> +    try:
> +      sample_counts_for_key = self.sample_counts[counts_key]
> +    except KeyError:
> +      self.sample_counts[counts_key] = {}
> +      sample_counts_for_key = self.sample_counts[counts_key]
> +
> +    aggregated_by_day = aggregate.aggregate_by_day(results)
> +    for day, values in aggregated_by_day.iteritems():
> +      try:
> +        sample_counts_for_key[day] += len(values)
> +      except KeyError:
> +        sample_counts_for_key[day] = len(values)

I've rewritten this based on Peter's suggestions so it's less confusing, but just for completeness: `sample_counts_for_key` is a value in the `self.sample_counts` dict, so when we update it, `self.sample_counts` gets updated because it has a reference to the dict we're updating.

---
Reply to this email directly or view it on GitHub:
https://github.com/opentechinstitute/mlab-observatory/pull/29/files#r21613049
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chambana.net/pipermail/commotion-admin/attachments/20141210/bf5d2c51/attachment.html>


More information about the Commotion-admin mailing list