blob: cb1a33961e45a5cb05895c3c232ddefaba2faa56 [file] [log] [blame]
Sree Kuchibhotla4dd02fc2016-05-17 18:01:43 -07001#!/usr/bin/env python2.7
2# Copyright 2016, Google Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above
12# copyright notice, this list of conditions and the following disclaimer
13# in the documentation and/or other materials provided with the
14# distribution.
15# * Neither the name of Google Inc. nor the names of its
16# contributors may be used to endorse or promote products derived from
17# this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30import argparse
31import os
32import sys
33
34stress_test_utils_dir = os.path.abspath(os.path.join(
35 os.path.dirname(__file__), '../../gcp/stress_test'))
36sys.path.append(stress_test_utils_dir)
37from stress_test_utils import BigQueryHelper
38
39argp = argparse.ArgumentParser(
40 description='Print summary tables',
41 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
42argp.add_argument('--gcp_project_id',
43 required=True,
44 help='The Google Cloud Platform Project Id')
45argp.add_argument('--dataset_id', type=str, required=True)
46argp.add_argument('--run_id', type=str, required=True)
47argp.add_argument('--summary_table_id', type=str, default='summary')
48argp.add_argument('--qps_table_id', type=str, default='qps')
49argp.add_argument('--summary_only', action='store_true', default=True)
50
51if __name__ == '__main__':
52 args = argp.parse_args()
53 bq_helper = BigQueryHelper(args.run_id, '', '', args.gcp_project_id,
54 args.dataset_id, args.summary_table_id,
55 args.qps_table_id)
56 bq_helper.initialize()
57 if not args.summary_only:
58 bq_helper.print_qps_records()
59 bq_helper.print_summary_records()