Exemplo n.º 1
0
def prepare_option_parser_for_split_or_continuous_workload(op, allow_between=False):
    # `--workload-during` specifies one or more workloads that will be run
    # continuously while other stuff is happening. `--extra-*` specifies how
    # many seconds to sit while the workloads are running.
    op["workload-during"] = vcoptparse.ValueFlag("--workload-during", converter=str, default=[], combiner=vcoptparse.append_combiner)
    op["extra-before"] = vcoptparse.IntFlag("--extra-before", 10)
    op["extra-between"] = vcoptparse.IntFlag("--extra-between", 10)
    op["extra-after"] = vcoptparse.IntFlag("--extra-after", 10)

    # `--workload-*` specifies a workload to run at some point in the scenario.
    # `--timeout-*` specifies the timeout to enforce for `--workload-*`.
    op["workload-before"] = vcoptparse.StringFlag("--workload-before", None)
    op["timeout-before"] = vcoptparse.IntFlag("--timeout-before", 600)
    if allow_between:
        op["workload-between"] = vcoptparse.StringFlag("--workload-between", None)
        op["timeout-between"] = vcoptparse.IntFlag("--timeout-between", 600)
    op["workload-after"] = vcoptparse.StringFlag("--workload-after", None)
    op["timeout-after"] = vcoptparse.IntFlag("--timeout-after", 600)
Exemplo n.º 2
0
                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