def calc_trim_mean_throughput(self, samples=8): """ Calculate the cluster average throughput out of a few samples Args: samples (int): The number of samples to take Returns: float: The average cluster throughput """ throughput_vals = [self.get_cluster_throughput() for _ in range(samples)] return round(get_trim_mean(throughput_vals), 3)
def calc_trim_metric_mean(self, metric=constants.LATENCY_QUERY, samples=5): """ Get the trimmed mean of a given metric Args: metric (str): The metric to calculate the average result for samples (int): The number of samples to take Returns: float: The average result for the metric """ vals = list() for i in range(samples): vals.append(round(self.get_query(metric), 5)) if i == samples - 1: break time.sleep(5) return round(get_trim_mean(vals), 5)
def calc_trim_metric_mean(self, metric, samples=5, mute_logs=False): """ Get the trimmed mean of a given metric Args: metric (str): The metric to calculate the average result for samples (int): The number of samples to take mute_logs (bool): True for muting the logs, False otherwise Returns: float: The average result for the metric """ vals = list() for i in range(samples): vals.append(round(self.get_query(metric, mute_logs), 5)) if i == samples - 1: break time.sleep(5) return round(get_trim_mean(vals), 5)