run-tests.py 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env python
  2. import argparse
  3. import sys
  4. from benchmark.benchmarker import Benchmarker
  5. from setup.linux.unbuffered import Unbuffered
  6. ###################################################################################################
  7. # Main
  8. ###################################################################################################
  9. # Enable unbuffered output so messages will appear in the proper order with subprocess output.
  10. sys.stdout=Unbuffered(sys.stdout)
  11. # Ensure the current directory (which should be the benchmark home directory) is in the path so that the tests can be imported.
  12. sys.path.append('.')
  13. # Ensure toolset/setup/linux is in the path so that the tests can "import setup_util".
  14. sys.path.append('toolset/setup/linux')
  15. ##########################################################
  16. # Set up argument parser
  17. ##########################################################
  18. parser = argparse.ArgumentParser(description='Run the Framework Benchmarking test suite.')
  19. parser.add_argument('-s', '--server-host', default='localhost', help='The application server.')
  20. parser.add_argument('-c', '--client-host', default='localhost', help='The client / load generation server.')
  21. parser.add_argument('-u', '--client-user', help='The username to use for SSH to the client instance.')
  22. parser.add_argument('-i', '--client-identity-file', dest='client_identity_file', help='The key to use for SSH to the client instance.')
  23. parser.add_argument('-d', '--database-host', help='The database server. If not provided, defaults to the value of --client-host.')
  24. parser.add_argument('--database-user', help='The username to use for SSH to the database instance. If not provided, defaults to the value of --client-user.')
  25. parser.add_argument('--database-identity-file', dest='database_identity_file', help='The key to use for SSH to the database instance. If not provided, defaults to the value of --client-identity-file.')
  26. parser.add_argument('-p', dest='password_prompt', action='store_true')
  27. parser.add_argument('--install-software', action='store_true', help='runs the installation script before running the rest of the commands')
  28. parser.add_argument('--install', choices=['client', 'database', 'server', 'all'], default='all', help='Allows you to only install the server, client, or database software')
  29. parser.add_argument('--install-error-action', choices=['abort', 'continue'], default='continue', help='action to take in case of error during installation')
  30. parser.add_argument('--test', nargs='+', help='names of tests to run')
  31. parser.add_argument('--exclude', nargs='+', help='names of tests to exclude')
  32. parser.add_argument('--type', choices=['all', 'json', 'db', 'query', 'fortune', 'update', 'plaintext'], default='all', help='which type of test to run')
  33. parser.add_argument('-m', '--mode', choices=['benchmark', 'verify'], default='benchmark', help='verify mode will only start up the tests, curl the urls and shutdown')
  34. parser.add_argument('--list-tests', action='store_true', default=False, help='lists all the known tests that can run')
  35. parser.add_argument('--next-sort', action='store_true', default=False, help='displays the next value that can be used as a sort value')
  36. parser.add_argument('--max-concurrency', default=256, help='the maximum concurrency that the tests will run at. The query tests will run at this concurrency', type=int)
  37. parser.add_argument('--max-queries', default=20, help='The maximum number of queries to run during the query test', type=int)
  38. parser.add_argument('--query-interval', default=5, type=int)
  39. parser.add_argument('--max-threads', default=8, help='The max number of threads to run weight at, this should be set to the number of cores for your system.', type=int)
  40. parser.add_argument('--duration', default=60, help='Time in seconds that each test should run for.')
  41. parser.add_argument('--starting-concurrency', default=8, type=int)
  42. parser.add_argument('--sleep', type=int, default=60, help='the amount of time to sleep after starting each test to allow the server to start up.')
  43. parser.add_argument('--parse', help='Parses the results of the given timestamp and merges that with the latest results')
  44. parser.add_argument('--name', default="ec2", help='The name to give this test. Results will be placed in a folder using this name.')
  45. parser.add_argument('--application-os', choices=['linux', 'windows'], default='linux', help='The operating system of the application server.')
  46. parser.add_argument('--database-os', choices=['linux', 'windows'], default='linux', help='The operating system of the database server.')
  47. args = parser.parse_args()
  48. benchmarker = Benchmarker(vars(args))
  49. # Run the benchmarker in the specified mode
  50. if benchmarker.list_tests:
  51. benchmarker.run_list_tests()
  52. elif benchmarker.next_sort:
  53. benchmarker.next_sort_value()
  54. elif benchmarker.parse != None:
  55. benchmarker.parse_timestamp()
  56. else:
  57. benchmarker.run()