From 39c7ae3441eaeb69f49ba2529f7cf6cd9cd8195b Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Sun, 5 Jul 2015 17:48:28 -0400 Subject: [PATCH] Cleanup dailycount graph subunit2sql-graph command The code that landed for the dailycount graph command was accidently an early prototype version of the graph, instead of the more polished version which was developed. This commit fixes a number of issues with the command, first the sampling frequency was every second instead of daily like the graph output implies. This is addressed by resampling the time series daily. The second issues was that the default fallback title was "Number of Tempest tests run in the Gate" which is obviously application specific. Lastly, the date filtering both didn't work and was using a different format than the help string perscribed. This is fixed by using the pandas based date filtering in the analysis utils module instead of the database api call option which uses a different format. Change-Id: If0fc077f2f77f6aeea914554d36cb5be8c90f323 Story: #2000311 --- subunit2sql/analysis/dailycount.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subunit2sql/analysis/dailycount.py b/subunit2sql/analysis/dailycount.py index ac7d262..d630252 100644 --- a/subunit2sql/analysis/dailycount.py +++ b/subunit2sql/analysis/dailycount.py @@ -17,6 +17,7 @@ import matplotlib.pyplot as plt from oslo.config import cfg import pandas as pd +from subunit2sql.analysis import utils from subunit2sql.db import api CONF = cfg.CONF @@ -30,14 +31,14 @@ def set_cli_opts(parser): def generate_series(): session = api.get_session() - test_starts = api.get_test_run_series(CONF.start_date, CONF.stop_date, - session) + test_starts = api.get_test_run_series(session) session.close() - daily_count = pd.Series(test_starts) - mean = pd.rolling_mean(daily_count, 20) - rolling_std = pd.rolling_std(daily_count, 20) + ts = pd.Series(test_starts).resample('D', how='sum') + daily_count = utils.filter_dates(ts) + mean = pd.rolling_mean(daily_count, 10) + rolling_std = pd.rolling_std(daily_count, 10) plt.figure() - title = CONF.title or 'Number of Tempest tests run in the Gate' + title = CONF.title or 'Number of tests run' plt.title(title) plt.ylabel('Number of tests') plt.plot(daily_count.index, daily_count, 'k', label='Daily Test Count')