xrange except NameError: xrange = range # Don't allow someone to run this without unlimited size core files - which are really useful for debugging assert resource.getrlimit(resource.RLIMIT_CORE)[0] == resource.RLIM_INFINITY opts = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(opts) opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random()) opts['servers'] = vcoptparse.IntFlag('--servers', 1) # Number of servers in the cluster opts['duration'] = vcoptparse.IntFlag( '--duration', 900) # Time to perform fuzzing in seconds opts['progress'] = vcoptparse.BoolFlag( '--progress', False) # Write messages every 10 seconds with the time remaining opts['threads'] = vcoptparse.IntFlag( '--threads', 16) # Number of client threads to run (not counting changefeeds) opts['changefeeds'] = vcoptparse.BoolFlag( '--changefeeds', False) # Whether or not to use changefeeds opts['kill'] = vcoptparse.BoolFlag( '--kill', False ) # Randomly kill and revive servers during fuzzing - will produce a lot of noise parsed_opts = opts.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags( parsed_opts) r = utils.import_python_driver() dbName, tableName = utils.get_test_db_table()
#!/usr/bin/env python # Copyright 2010-2015 RethinkDB, all rights reserved. import os, sys sys.path.append( os.path.abspath( os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import driver, rdb_unittest, scenario_common, utils, vcoptparse, workload_runner op = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(op) op["use-proxy"] = vcoptparse.BoolFlag("--use-proxy") op["num-shards"] = vcoptparse.IntFlag("--num-shards", 2) op["workload"] = vcoptparse.PositionalArg() op["timeout"] = vcoptparse.IntFlag("--timeout", 1200) opts = op.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags(opts) class StaticCluster(rdb_unittest.RdbTestCase): '''Run a workload on an unchanging cluster''' shards = opts["num-shards"] server_command_prefix = command_prefix server_extra_options = serve_options def test_workload(self): workloadServer = self.cluster[0]
try: xrange except NameError: xrange = range opts = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(opts) opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random()) opts['num-tables'] = vcoptparse.IntFlag('--num-tables', 6) # Number of tables to create opts['table-scale'] = vcoptparse.IntFlag('--table-scale', 7) # Factor of increasing table size opts['duration'] = vcoptparse.IntFlag( '--duration', 120) # Time to perform fuzzing in seconds opts['ignore-timeouts'] = vcoptparse.BoolFlag( '--ignore-timeouts') # Ignore table_wait timeouts and continue opts['progress'] = vcoptparse.BoolFlag( '--progress') # Write messages every 10 seconds with the time remaining parsed_opts = opts.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags( parsed_opts) r = utils.import_python_driver() dbName, tableName = utils.get_test_db_table() server_names = ['War', 'Famine', 'Pestilence', 'Death'] tables = [chr(ord('a') + i) for i in xrange(parsed_opts['num-tables'])] table_counts = [ pow(parsed_opts['table-scale'], i) for i in xrange(len(tables)) ] db = 'test'
startTime = time.time() sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import driver, scenario_common, utils, vcoptparse try: xrange except NameError: xrange = range opts = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(opts) opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random()) opts['servers'] = vcoptparse.IntFlag('--servers', 1) # Number of servers in the cluster opts['duration'] = vcoptparse.IntFlag('--duration', 900) # Time to perform fuzzing in seconds opts['progress'] = vcoptparse.BoolFlag('--progress', False) # Write messages every 10 seconds with the time remaining opts['threads'] = vcoptparse.IntFlag('--threads', 16) # Number of client threads to run (not counting changefeeds) opts['changefeeds'] = vcoptparse.BoolFlag('--changefeeds', False) # Whether or not to use changefeeds parsed_opts = opts.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags(parsed_opts) r = utils.import_python_driver() dbName, tableName = utils.get_test_db_table() server_names = list(string.ascii_lowercase[:parsed_opts['servers']]) system_tables = ['table_config', 'server_config', 'db_config', 'cluster_config', 'table_status',
def prepare_option_parser_mode_flags(opt_parser): opt_parser["valgrind"] = vcoptparse.BoolFlag("--valgrind") opt_parser["valgrind-options"] = vcoptparse.StringFlag("--valgrind-options", "--leak-check=full --track-origins=yes --child-silent-after-fork=yes") opt_parser["wrapper"] = vcoptparse.StringFlag("--wrapper", None) opt_parser["mode"] = vcoptparse.StringFlag("--mode", "") opt_parser["serve-flags"] = vcoptparse.StringFlag("--serve-flags", "")
try: xrange except NameError: xrange = range sys.path.append( os.path.abspath( os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import rdb_workload_common, vcoptparse, utils errorToleranceSecs = 5 batchSize = 100 op = rdb_workload_common.option_parser_for_connect() op["num_rows"] = vcoptparse.IntFlag("--num-rows", 5000) op["sequential"] = vcoptparse.BoolFlag("--sequential") op["phase"] = vcoptparse.ChoiceFlag("--phase", ["w", "r", "wr"], "wr") op["tolerate_errors"] = vcoptparse.BoolFlag("--tolerate-errors", invert=True) opts = op.parse(sys.argv) with rdb_workload_common.make_table_and_connection(opts) as (table, conn): keys = None if "w" in opts["phase"]: utils.print_with_time("Inserting rows") # - generate the ids keys = [] if opts["sequential"]: keys = xrange(opts["num_rows"])