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

mtlynch notifications at github.com
Wed Dec 10 11:04:12 EST 2014


> +    """
> +    hash_key = '%s-%s' % (metadata['site_name'], metadata['isp'])
> +    return hash_key
> +
> +
> +class SampleCountChecker(object):
> +
> +  def __init__(self, sample_counter, sample_period_end,
> +               min_samples_per_day, percentage_of_days_threshold):
> +    """Checks whether sample counts for given dataset meet requirements.
> +
> +    Args:
> +      sample_counter: (SampleCounter) Object tracking sample counts for each
> +        dataset.
> +
> +      sample_period_end: (datetime.datetime) Time at which the relevant period

The "true" sample period start would be the date that the site came online, but since we don't have a good way of getting this programmatically, we're cheating a bit and using the first occurring sample in the dataset as the implicit start of the sample period. We could have done the same with the end date, but the end date is easy to specify for every dataset, so we allow the caller to specify.

I thought about implementing a `sample_period_start` parameter for symmetry, which would default to using an implicit date if it was set to `None` but I felt like it doesn't make sense to add that logic/tests until we can actually use it.

I've added a note in the docstring to explain better why the start is missing.

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


More information about the Commotion-admin mailing list