示例#1
0
def describe(migration):
    puts('\nMembership')
    with indent():
        puts(get_membership(migration.target_couch_config).get_printable())
    puts('\nDB Info')
    print_db_info(migration.target_couch_config)

    puts('\nShard allocation')
    diff_with_db = None
    if os.path.exists(migration.shard_plan_path):
        diff_with_db = diff_plan(migration)
        if diff_with_db:
            puts(color_highlight('DB allocation differs from plan:\n'))
            puts("{}\n\n".format(diff_with_db))
        else:
            puts(color_success('DB allocation matches plan.'))

    if not diff_with_db:
        print_shard_table([
            get_shard_allocation(migration.target_couch_config, db_name)
            for db_name in sorted(
                get_db_list(migration.target_couch_config.get_control_node()))
        ])

    puts('\nShard count by node')
    print_shard_allocation_by_node([
        get_shard_allocation(migration.target_couch_config, db_name)
        for db_name in sorted(
            get_db_list(migration.target_couch_config.get_control_node()))
    ])
    return 0
def describe(migration):
    print u'\nMembership'
    with indent():
        puts(get_membership(migration.target_couch_config).get_printable())
    print u'\nDB Info'
    print_db_info(migration.target_couch_config)
    print u'\nShards'
    print_shard_table([
        get_shard_allocation(migration.target_couch_config, db_name)
        for db_name in sorted(
            get_db_list(migration.target_couch_config.get_control_node()))
    ])
    return 0
示例#3
0
    def run(self, args, unknown_args):
        environment = get_environment(args.env_name)
        couch_config = get_couch_config(environment)

        puts(u'\nMembership')
        with indent():
            puts(get_membership(couch_config).get_printable())

        puts(u'\nDB Info')
        print_db_info(couch_config)

        puts(u'\nShard allocation')
        print_shard_table([
            get_shard_allocation(couch_config, db_name)
            for db_name in sorted(get_db_list(couch_config.get_control_node()))
        ])
        return 0
示例#4
0
def describe(migration):
    puts(u'\nMembership')
    with indent():
        puts(get_membership(migration.target_couch_config).get_printable())
    puts(u'\nDB Info')
    print_db_info(migration.target_couch_config)

    puts(u'\nShard allocation')
    diff_with_db = diff_plan(migration)
    if diff_with_db:
        puts(colored.yellow('DB allocation differs from plan:\n'))
        puts("{}\n\n".format(diff_with_db))
    else:
        puts(colored.green('DB allocation matches plan.'))
        print_shard_table([
            get_shard_allocation(migration.target_couch_config, db_name)
            for db_name in sorted(get_db_list(migration.target_couch_config.get_control_node()))
        ])
    return 0
示例#5
0
def describe(migration):
    puts(u'\nMembership')
    with indent():
        puts(get_membership(migration.target_couch_config).get_printable())
    puts(u'\nDB Info')
    print_db_info(migration.target_couch_config)

    puts(u'\nShard allocation')
    diff_with_db = diff_plan(migration)
    if diff_with_db:
        puts(colored.yellow('DB allocation differs from plan:\n'))
        puts("{}\n\n".format(diff_with_db))
    else:
        puts(colored.green('DB allocation matches plan.'))
        print_shard_table([
            get_shard_allocation(migration.target_couch_config, db_name)
            for db_name in sorted(
                get_db_list(migration.target_couch_config.get_control_node()))
        ])
    return 0