except: workingValue = returnValue[-1] for char in step: if char == '-': workingValue -= 1 elif char == '+': workingValue += 1 else: raise ValueError('Got a bad step value: %s' % repr(char)) assert char in ('-', '+') returnValue += (workingValue,) return returnValue op = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(op) workload_runner.prepare_option_parser_for_split_or_continuous_workload(op, allow_between = True) op["num-nodes"] = vcoptparse.IntFlag("--num-nodes", 3) op["sequence"] = vcoptparse.ValueFlag("--sequence", converter=sequence_from_string, default=(2, 3)) opts = op.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags(opts) class Rebalance(rdb_unittest.RdbTestCase): '''Change the number of shards on a table.''' # keep the same number of replicas as nodes so we don't have to backfill constantly replicas = opts["num-nodes"] shards = 1 server_command_prefix = command_prefix server_extra_options = serve_options
#!/usr/bin/env python # Copyright 2010-2012 RethinkDB, all rights reserved. import sys, os, time sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import http_admin, driver, workload_runner, scenario_common, rdb_workload_common from vcoptparse import * op = OptParser() scenario_common.prepare_option_parser_mode_flags(op) workload_runner.prepare_option_parser_for_split_or_continuous_workload(op) op["num-nodes"] = IntFlag("--num-nodes", 2) opts = op.parse(sys.argv) with driver.Metacluster() as metacluster: cluster = driver.Cluster(metacluster) executable_path, command_prefix, serve_options = scenario_common.parse_mode_flags(opts) print "Starting cluster..." processes = [driver.Process(cluster, driver.Files(metacluster, db_path = "db-%d" % i, log_path = "create-output-%d" % i, executable_path = executable_path, command_prefix = command_prefix), log_path = "serve-output-%d" % i, executable_path = executable_path, command_prefix = command_prefix, extra_options = serve_options) for i in xrange(opts["num-nodes"])] for process in processes: process.wait_until_started_up() print "Creating table..." http = http_admin.ClusterAccess([("localhost", p.http_port) for p in processes]) primary_dc = http.add_datacenter() secondary_dc = http.add_datacenter() machines = http.machines.keys()
# Copyright 2010-2012 RethinkDB, all rights reserved. #!/usr/bin/python # Copyright 2010-2012 RethinkDB, all rights reserved. import sys, os, time sys.path.append( os.path.abspath( os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import http_admin, driver, workload_runner, scenario_common from vcoptparse import * op = OptParser() workload_runner.prepare_option_parser_for_split_or_continuous_workload(op) scenario_common.prepare_option_parser_mode_flags(op) opts = op.parse(sys.argv) with driver.Metacluster() as metacluster: print "Starting cluster..." cluster = driver.Cluster(metacluster) executable_path, command_prefix, serve_options = scenario_common.parse_mode_flags( opts) primary_files = driver.Files(metacluster, db_path="db-1", log_path="create-output-1", executable_path=executable_path, command_prefix=command_prefix) primary = driver.Process(cluster, primary_files, log_path="serve-output-1", executable_path=executable_path, command_prefix=command_prefix, extra_options=serve_options)
workingValue = returnValue[-1] for char in step: if char == '-': workingValue -= 1 elif char == '+': workingValue += 1 else: raise ValueError('Got a bad step value: %s' % repr(char)) assert char in ('-', '+') returnValue += (workingValue, ) return returnValue op = vcoptparse.OptParser() scenario_common.prepare_option_parser_mode_flags(op) workload_runner.prepare_option_parser_for_split_or_continuous_workload( op, allow_between=True) op["num-nodes"] = vcoptparse.IntFlag("--num-nodes", 3) op["sequence"] = vcoptparse.ValueFlag("--sequence", converter=sequence_from_string, default=(2, 3)) opts = op.parse(sys.argv) _, command_prefix, serve_options = scenario_common.parse_mode_flags(opts) class Rebalance(rdb_unittest.RdbTestCase): '''Change the number of shards on a table.''' # keep the same number of replicas as nodes so we don't have to backfill constantly replicas = opts["num-nodes"] shards = 1