Sree Kuchibhotla | 4dd02fc | 2016-05-17 18:01:43 -0700 | [diff] [blame] | 1 | #!/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. |
| 30 | import argparse |
| 31 | import os |
| 32 | import sys |
| 33 | |
| 34 | stress_test_utils_dir = os.path.abspath(os.path.join( |
| 35 | os.path.dirname(__file__), '../../gcp/stress_test')) |
| 36 | sys.path.append(stress_test_utils_dir) |
| 37 | from stress_test_utils import BigQueryHelper |
| 38 | |
| 39 | argp = argparse.ArgumentParser( |
| 40 | description='Print summary tables', |
| 41 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 42 | argp.add_argument('--gcp_project_id', |
| 43 | required=True, |
| 44 | help='The Google Cloud Platform Project Id') |
| 45 | argp.add_argument('--dataset_id', type=str, required=True) |
| 46 | argp.add_argument('--run_id', type=str, required=True) |
| 47 | argp.add_argument('--summary_table_id', type=str, default='summary') |
| 48 | argp.add_argument('--qps_table_id', type=str, default='qps') |
| 49 | argp.add_argument('--summary_only', action='store_true', default=True) |
| 50 | |
| 51 | if __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() |