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

mtlynch notifications at github.com
Wed Dec 10 15:26:10 EST 2014


> +    the same dataset and aggregating the results).
> +
> +    Args:
> +      filename: (str) Name of file to add to blacklist database.
> +    """
> +    parsed_metadata = telescope_data_parser.parse_filename_for_metadata(
> +        filename)
> +
> +    # only base list on download throughput
> +    if parsed_metadata['metric_name'] != 'download_throughput':
> +      return
> +
> +    with open(filename, 'r') as data_file:
> +      parsed_data = telescope_data_parser.parse_data_file(data_file)
> +
> +    self._sample_counter.add_to_counts(parsed_metadata, parsed_data)

Won't it crash anyway when it fails to open the file? I figured this way we'd close the file sooner, but it doesn't matter much either way, so I put it under the `with`.

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


More information about the Commotion-admin mailing list