def get_test_run_series(start_date=None, stop_date=None, session=None,
                        key='build_queue', value='gate'):
    session = session or get_session()
    full_query = db_utils.model_query(models.Run, session=session)
    if key and value:
        full_query = full_query.join(
            models.RunMetadata,
            models.Run.id == models.RunMetadata.run_id).filter_by(
                key=key, value=value)

    # Process date bounds
    full_query = _filter_runs_by_date(full_query, start_date, stop_date)

    query = full_query.values(models.Run.run_at, models.Run.passes,
                              models.Run.fails)
    time_series = {}
    for test_run in query:
        start_time = test_run[0]
        # Sum of starts and failures is the count for the run
        local_run_count = test_run[1] + test_run[2]
        if start_time in time_series:
            time_series[start_time] = time_series[start_time] + local_run_count
        else:
            time_series[start_time] = local_run_count
    return time_series
Returns a time series dict of total daily run counts
dataset/ETHPy150Open openstack-infra/subunit2sql/subunit2sql/db/api.py/get_test_run_series