예제 #1
0
def generate_series():
    test_id = CONF.command.test_id
    session = api.get_session()
    run_times = api.get_test_run_time_series(test_id, session)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    mean = pd.rolling_mean(ts, 20)
    rolling_std = pd.rolling_std(ts, 20)
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel("Time (sec.)")
    plt.plot(ts.index, ts, "k", label="Run Time")
    plt.plot(mean.index, mean, "b", label="Avg. Run Time")
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index, upper_std_dev, lower_std_dev, color="b", alpha=0.2, label="std dev")
    plt.legend()
    plt.savefig(CONF.output, dpi=900)
    return ts
예제 #2
0
def generate_series():
    session = api.get_session()
    test_starts = api.get_test_run_series(session)
    session.close()
    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 tests run'
    plt.title(title)
    plt.ylabel('Number of tests')
    plt.plot(daily_count.index, daily_count, 'k', label='Daily Test Count')
    plt.plot(mean.index, mean, 'b', label='Avg. Daily Test Count')
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index,
                     lower_std_dev,
                     upper_std_dev,
                     color='b',
                     alpha=0.2,
                     label='std dev')
    plt.legend()
    plt.savefig(CONF.output)
예제 #3
0
def generate_series():
    session = api.get_session()
    test_id = api.get_id_from_test_id(CONF.command.test_id, session)
    if not test_id:
        print("The test_id %s was not found in the database" %
              CONF.command.test_id)
        exit(2)
    run_times = api.get_test_run_time_series(test_id, session)
    if not run_times:
        print("There was no data found in the database")
        exit(3)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    if ts.count() == 0:
        print("No data available. Check your query and try again.")
        exit(-1)
    mean = pd.rolling_mean(ts, 20)
    rolling_std = pd.rolling_std(ts, 20)
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel('Time (sec.)')

    # format x-axis with dates
    fig, ax = plt.subplots(1)
    fig.autofmt_xdate()
    xfmt = dates.DateFormatter("%b %d %Y")
    ax.xaxis_date()
    ax.xaxis.set_major_formatter(xfmt)

    plt.plot(ts.index, ts, 'k', label='Run Time')
    plt.plot(mean.index, mean, 'b', label='Avg. Run Time')
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index,
                     upper_std_dev,
                     lower_std_dev,
                     color='b',
                     alpha=0.2,
                     label='std dev')
    plt.legend()
    plt.savefig(CONF.output, dpi=900)
    return ts
예제 #4
0
def generate_series():
    session = api.get_session()
    test_id = api.get_id_from_test_id(CONF.command.test_id, session)
    if not test_id:
        print("The test_id %s was not found in the database" %
              CONF.command.test_id)
        exit(2)
    run_times = api.get_test_run_time_series(test_id, session)
    if not run_times:
        print("There was no data found in the database")
        exit(3)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    if ts.count() == 0:
        print("No data available. Check your query and try again.")
        exit(-1)
    roll = ts.rolling(window=20, center=False)
    mean = roll.mean()
    rolling_std = roll.std()
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel('Time (sec.)')

    # format x-axis with dates
    fig, ax = plt.subplots(1)
    fig.autofmt_xdate()
    xfmt = dates.DateFormatter("%b %d %Y")
    ax.xaxis_date()
    ax.xaxis.set_major_formatter(xfmt)

    plt.plot(ts.index, ts, 'ko', label='Run Time', markersize=0.45)
    plt.plot(mean.index, mean, 'b', label='Avg. Run Time', linewidth=0.45)
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index, upper_std_dev,
                     lower_std_dev, color='b', alpha=0.2,
                     label='std dev')
    plt.legend()
    plt.savefig(CONF.output, dpi=CONF.dpi)
    return ts
예제 #5
0
def generate_series():
    session = api.get_session()
    test_id = api.get_id_from_test_id(CONF.command.test_id, session)
    test_statuses = api.get_test_status_time_series(test_id, session)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(test_statuses)
    ts = utils.filter_dates(ts)
    run_count = len(ts)
    if run_count == 0:
        print("Query returned no data.")
        exit(-1)
    failures = ts[ts.isin(['fail', 'unxsuccess'])]
    successes = ts[ts.isin(['success', 'xfail'])]
    skips = ts[ts.isin(['skip'])]
    fail_count = len(failures)
    success_count = len(successes)
    skip_count = len(skips)
    fail_group = failures.groupby(failures.index.date).agg(len)
    success_group = successes.groupby(successes.index.date).agg(len)
    skip_group = skips.groupby(skips.index.date).agg(len)
    if not CONF.title:
        plot = fail_group.plot().set_title(test.test_id)
    else:
        plot = fail_group.plot().set_title(CONF.title)
    if CONF.command.success_graph:
        if success_count:
            success_group.plot()
    if CONF.command.skip_graph:
        if skip_count:
            skip_group.plot()

    def percent(count, total):
        count = float(count)
        total = float(total)
        return (count / total) * 100.0

    print('Fail Percentage: %.4f%%' % percent(fail_count, run_count))
    print('Success Percentage: %.4f%%' % percent(success_count, run_count))
    print('Skip Percentage: %.4f%%' % percent(skip_count, run_count))
    fig = plot.get_figure()
    fig.savefig(CONF.output)
    return ts
예제 #6
0
def generate_series():
    session = api.get_session()
    test_starts = api.get_test_run_series(session)
    session.close()
    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 tests run'
    plt.title(title)
    plt.ylabel('Number of tests')
    plt.plot(daily_count.index, daily_count, 'k', label='Daily Test Count')
    plt.plot(mean.index, mean, 'b', label='Avg. Daily Test Count')
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index, lower_std_dev, upper_std_dev,
                     color='b', alpha=0.2, label='std dev')
    plt.legend()
    plt.savefig(CONF.output)