예제 #1
0
def main():
    parser = argparse.ArgumentParser(description='Control your bigchain node.',
                                     parents=[base_parser])

    # all the commands are contained in the subparsers object,
    # the command selected by the user will be stored in `args.command`
    # that is used by the `main` function to select which other
    # function to call.
    subparsers = parser.add_subparsers(title='Commands',
                                       dest='command')

    subparsers.add_parser('configure',
                          help='Prepare the config file and create the node keypair')

    # parser for database level commands
    subparsers.add_parser('init',
                          help='Init the database')

    subparsers.add_parser('drop',
                          help='Drop the database')

    # TODO how about just config, or info?
    subparsers.add_parser('show-config',
                          help='Show the current configuration')

    subparsers.add_parser('start',
                          help='Start bigchain')

    start(parser, globals())
예제 #2
0
def main():
    parser = argparse.ArgumentParser(description='Control your bigchain node.',
                                     parents=[base_parser])

    # all the commands are contained in the subparsers object,
    # the command selected by the user will be stored in `args.command`
    # that is used by the `main` function to select which other
    # function to call.
    subparsers = parser.add_subparsers(title='Commands', dest='command')

    subparsers.add_parser(
        'configure',
        help='Prepare the config file and create the node keypair')

    # parser for database level commands
    subparsers.add_parser('init', help='Init the database')

    subparsers.add_parser('drop', help='Drop the database')

    # TODO how about just config, or info?
    subparsers.add_parser('show-config', help='Show the current configuration')

    subparsers.add_parser('start', help='Start bigchain')

    start(parser, globals())
예제 #3
0
def main():
    parser = argparse.ArgumentParser(description='BigchainDB benchmarking utils')
    subparsers = parser.add_subparsers(title='Commands', dest='command')

    # add transactions to backlog
    backlog_parser = subparsers.add_parser('add-backlog',
                                           help='Add transactions to the backlog')
    backlog_parser.add_argument('num_transactions', metavar='num_transactions', type=int, default=0,
                                help='Number of transactions to add to the backlog')

    # set statsd host
    statsd_parser = subparsers.add_parser('set-statsd-host',
                                          help='Set statsd host')
    statsd_parser.add_argument('statsd_host', metavar='statsd_host', default='localhost',
                               help='Hostname of the statsd server')

    # metrics
    metrics_parser = subparsers.add_parser('gather-metrics',
                                           help='Gather metrics to a csv file')

    metrics_parser.add_argument('-b', '--bigchaindb-host',
                                required=True,
                                help='Bigchaindb node hostname to connect to gather cluster metrics')

    metrics_parser.add_argument('-c', '--csvfile',
                                required=True,
                                help='Filename to save the metrics')

    utils.start(parser, globals())
예제 #4
0
def main():
    parser = argparse.ArgumentParser(description='Benchmark your bigchain federation.',
                                     parents=[base_parser])

    # all the commands are contained in the subparsers object,
    # the command selected by the user will be stored in `args.command`
    # that is used by the `main` function to select which other
    # function to call.
    subparsers = parser.add_subparsers(title='Commands',
                                       dest='command')

    # parser for database level commands
    load_parser = subparsers.add_parser('load',
                                        help='Write transactions to the backlog')

    load_parser.add_argument('-m', '--multiprocess',
                             nargs='?',
                             type=int,
                             default=False,
                             help='Spawn multiple processes to run the command, '
                                  'if no value is provided, the number of processes '
                                  'is equal to the number of cores of the host machine')

    load_parser.add_argument('-c', '--count',
                             default=0,
                             type=int,
                             help='Number of transactions to push. If the parameter -m '
                                  'is set, the count is distributed equally to all the '
                                  'processes')

    start(parser, globals())
예제 #5
0
def main():
    parser = argparse.ArgumentParser(
        description='Control your BigchainDB node.',
        parents=[utils.base_parser])

    parser.add_argument('--experimental-start-rethinkdb',
                        dest='start_rethinkdb',
                        action='store_true',
                        help='Run RethinkDB on start')

    # all the commands are contained in the subparsers object,
    # the command selected by the user will be stored in `args.command`
    # that is used by the `main` function to select which other
    # function to call.
    subparsers = parser.add_subparsers(title='Commands',
                                       dest='command')

    # parser for writing a config file
    subparsers.add_parser('configure',
                          help='Prepare the config file '
                               'and create the node keypair')

    # parsers for showing/exporting config values
    subparsers.add_parser('show-config',
                          help='Show the current configuration')

    subparsers.add_parser('export-my-pubkey',
                          help="Export this node's public key")

    # parser for database-level commands
    subparsers.add_parser('init',
                          help='Init the database')

    subparsers.add_parser('drop',
                          help='Drop the database')

    # parser for starting BigchainDB
    subparsers.add_parser('start',
                          help='Start BigchainDB')

    load_parser = subparsers.add_parser('load',
                                        help='Write transactions to the backlog')

    load_parser.add_argument('-m', '--multiprocess',
                             nargs='?',
                             type=int,
                             default=False,
                             help='Spawn multiple processes to run the command, '
                                  'if no value is provided, the number of processes '
                                  'is equal to the number of cores of the host machine')

    load_parser.add_argument('-c', '--count',
                             default=0,
                             type=int,
                             help='Number of transactions to push. If the parameter -m '
                                  'is set, the count is distributed equally to all the '
                                  'processes')

    utils.start(parser, globals())
예제 #6
0
def test_start_raises_if_no_arguments_given():
    from bigchaindb.commands import utils
    from bigchaindb.commands.bigchaindb import create_parser

    parser = create_parser()

    with pytest.raises(SystemExit):
        utils.start(parser, [], {})
예제 #7
0
def test_start_raises_if_no_arguments_given():
    from bigchaindb.commands import utils
    from bigchaindb.commands.bigchaindb import create_parser

    parser = create_parser()

    with pytest.raises(SystemExit):
        utils.start(parser, [], {})
예제 #8
0
def main():
    parser = argparse.ArgumentParser(
        description='Control your BigchainDB node.',
        parents=[utils.base_parser])

    parser.add_argument('--experimental-start-rethinkdb',
                        dest='start_rethinkdb',
                        action='store_true',
                        help='Run RethinkDB on start')

    # all the commands are contained in the subparsers object,
    # the command selected by the user will be stored in `args.command`
    # that is used by the `main` function to select which other
    # function to call.
    subparsers = parser.add_subparsers(title='Commands', dest='command')

    # parser for writing a config file
    subparsers.add_parser('configure',
                          help='Prepare the config file '
                          'and create the node keypair')

    # parsers for showing/exporting config values
    subparsers.add_parser('show-config', help='Show the current configuration')

    subparsers.add_parser('export-my-pubkey',
                          help="Export this node's public key")

    # parser for database-level commands
    subparsers.add_parser('init', help='Init the database')

    subparsers.add_parser('drop', help='Drop the database')

    # parser for starting BigchainDB
    subparsers.add_parser('start', help='Start BigchainDB')

    load_parser = subparsers.add_parser(
        'load', help='Write transactions to the backlog')

    load_parser.add_argument(
        '-m',
        '--multiprocess',
        nargs='?',
        type=int,
        default=False,
        help='Spawn multiple processes to run the command, '
        'if no value is provided, the number of processes '
        'is equal to the number of cores of the host machine')

    load_parser.add_argument(
        '-c',
        '--count',
        default=0,
        type=int,
        help='Number of transactions to push. If the parameter -m '
        'is set, the count is distributed equally to all the '
        'processes')

    utils.start(parser, globals())
예제 #9
0
def test_start_raises_if_command_not_implemented():
    from bigchaindb.commands import utils
    from bigchaindb.commands.bigchaindb import create_parser

    parser = create_parser()

    with pytest.raises(NotImplementedError):
        # Will raise because `scope`, the third parameter,
        # doesn't contain the function `run_start`
        utils.start(parser, ['start'], {})
예제 #10
0
def test_start_raises_if_command_not_implemented():
    from bigchaindb.commands import utils
    from bigchaindb.commands.bigchaindb import create_parser

    parser = create_parser()

    with pytest.raises(NotImplementedError):
        # Will raise because `scope`, the third parameter,
        # doesn't contain the function `run_start`
        utils.start(parser, ['start'], {})
예제 #11
0
def test_start_sets_multiprocess_var_based_on_cli_args(mock_cpu_count):
    from bigchaindb.commands import utils

    def run_mp_arg_test(args):
        return args

    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers(title='Commands',
                                      dest='command')
    mp_arg_test_parser = subparser.add_parser('mp_arg_test')
    mp_arg_test_parser.add_argument('-m', '--multiprocess',
                                    nargs='?',
                                    type=int,
                                    default=False)

    scope = {'run_mp_arg_test': run_mp_arg_test}
    assert utils.start(parser, ['mp_arg_test'], scope).multiprocess == 1
    assert utils.start(parser, ['mp_arg_test', '--multiprocess'], scope).multiprocess == 42
예제 #12
0
def test_start_sets_multiprocess_var_based_on_cli_args(mock_cpu_count):
    from bigchaindb.commands import utils

    def run_mp_arg_test(args):
        return args

    parser = argparse.ArgumentParser()
    subparser = parser.add_subparsers(title='Commands', dest='command')
    mp_arg_test_parser = subparser.add_parser('mp_arg_test')
    mp_arg_test_parser.add_argument('-m',
                                    '--multiprocess',
                                    nargs='?',
                                    type=int,
                                    default=False)

    scope = {'run_mp_arg_test': run_mp_arg_test}
    assert utils.start(parser, ['mp_arg_test'], scope).multiprocess == 1
    assert utils.start(parser, ['mp_arg_test', '--multiprocess'],
                       scope).multiprocess == 42
예제 #13
0
def main():
    utils.start(create_parser(), sys.argv[1:], globals())
예제 #14
0
def main():
    utils.start(create_parser(), sys.argv[1:], globals())