Merge "Properly interpolate missing data for test_runs"

This commit is contained in:
Jenkins 2015-12-16 21:13:02 +00:00 committed by Gerrit Code Review
commit 8559e8f0b9
2 changed files with 15 additions and 14 deletions

View File

@ -12,6 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
resample_matrix = {
'day': 'D',
'hour': '1H',
'min': '1T',
'sec': '1S',
}
class BaseAggregator(object): class BaseAggregator(object):
def _update_datetime_to_fit_resolution(self, def _update_datetime_to_fit_resolution(self,

View File

@ -15,7 +15,7 @@
import pandas as pd import pandas as pd
from subunit2sql import read_subunit from subunit2sql import read_subunit
from base_aggregator import BaseAggregator import base_aggregator as base
def convert_test_runs_list_to_time_series_dict(test_runs_list, resample): def convert_test_runs_list_to_time_series_dict(test_runs_list, resample):
@ -49,22 +49,16 @@ def convert_test_runs_list_to_time_series_dict(test_runs_list, resample):
df['stddev_run_time'] = pd.rolling_std(df['run_time'], 20) df['stddev_run_time'] = pd.rolling_std(df['run_time'], 20)
# Resample numeric data for the run_time graph from successful runs # Resample numeric data for the run_time graph from successful runs
resample_matrix = {
'day': 'D',
'hour': '1H',
'min': '1T',
'sec': '1S',
}
numeric_df = df[df['status'] == 'success'].resample( numeric_df = df[df['status'] == 'success'].resample(
resample_matrix[resample], how='mean') base.resample_matrix[resample], how='mean')
# Drop duplicate or invalid colums # Drop duplicate or invalid colums
del(numeric_df['run_id']) del(numeric_df['run_id'])
del(df['run_time']) del(df['run_time'])
del(df['avg_run_time']) # Interpolate missing data
del(df['stddev_run_time']) numeric_df['run_time'] = numeric_df.interpolate(method='time', limit=20)
# Add rolling mean and std dev of run_time to datafram
# Drop missing data from the resample numeric_df['avg_run_time'] = pd.rolling_mean(numeric_df['run_time'], 20)
numeric_df = numeric_df.dropna(how='all') numeric_df['stddev_run_time'] = pd.rolling_std(numeric_df['run_time'], 20)
# Convert the dataframes to a dict # Convert the dataframes to a dict
numeric_dict = dict( numeric_dict = dict(
@ -131,7 +125,7 @@ class Counter(object):
return (self.passes, self.failures, self.skips) return (self.passes, self.failures, self.skips)
class TestRunAggregator(BaseAggregator): class TestRunAggregator(base.BaseAggregator):
def __init__(self, test_runs): def __init__(self, test_runs):
self.test_runs = test_runs self.test_runs = test_runs