Exemple #1
0
def compare_runs():
    """Gets information on each session in old and new, generates a comparison CSV of averages"""
    old_sessions, new_sessions, csv_output = get_args()
    run_data = collections.defaultdict(dict)
    run_data['old']['session_ids'] = old_sessions
    run_data['new']['session_ids'] = new_sessions

    # get session information for all runs
    for run_name in run_data:
        run_data[run_name]['session_data'] = []
        for session_id in run_data[run_name]['session_ids']:
            session = Session(session_id)
            session.get_average_info()
            run_data[run_name]['session_data'].append(session)

        # aggregate session averages
        run_data[run_name][
            'session_averages'] = combine_runs.aggregate_session_averages(
                run_data[run_name]['session_data'])

    avg_comparison = combine_runs.compare_averages(run_data)

    # GENERATE_SUMMARY
    if printer.generate_csv_avg_comparison(avg_comparison, 'old', ["new"],
                                           csv_output):
        exit(0)
    exit(1)
Exemple #2
0
def run_1_data():
    session_1 = Session('invalid')
    session_2 = Session('invalid')
    session_1.average_info = SESSION_1_DATA
    session_2.average_info = SESSION_2_DATA

    return combine_runs.aggregate_session_averages([session_1, session_2])
Exemple #3
0
def compare_runs():
    """Gets information on each run_name"""
    old_run, new_runs, csv_output = get_args()
    all_runs = new_runs[:]
    all_runs.append(old_run)

    run_data = collections.defaultdict(dict)
    for run in all_runs:
        run_info = api.bm_api(
            "GET",
            url=
            f'/masters?projectId=PROJECT_ID&workspaceId=WORKSPACE_ID&limit=10&name={run}'
        )
        run_sessions = [
            session for run in run_info.get('result', [])
            for session in run.get('sessionsId', [])
        ]
        run_data[run]['session_ids'] = run_sessions
        if not run_sessions:
            print("Could not find any sessions associated with {run_name}".
                  format(run_name=run))
            exit(1)

    # get session information for all runs
    for run_name in run_data:
        run_data[run_name]['session_data'] = []
        for session_id in run_data[run_name]['session_ids']:
            session = Session(session_id)
            session.get_average_info()
            run_data[run_name]['session_data'].append(session)

        # aggregate session averages
        run_data[run_name][
            'session_averages'] = combine_runs.aggregate_session_averages(
                run_data[run_name]['session_data'])

    avg_comparison = combine_runs.compare_averages(run_data)

    # GENERATE_SUMMARY
    if printer.generate_csv_avg_comparison(avg_comparison, old_run, new_runs,
                                           csv_output):
        exit(0)
    exit(1)
Exemple #4
0
def run_2_data():
    session_3 = Session('invalid')
    session_3.average_info = SESSION_3_DATA

    return combine_runs.aggregate_session_averages([session_3])
Exemple #5
0
def test_invalid_aggregate_session_averages():
    invalid_session = Session('invalid')
    average_data = combine_runs.aggregate_session_averages([invalid_session])
    assert not average_data