'swift-ring-builder <ring_file> write_builder [min_part_hours]
Recreate a builder from a ring file (lossy) if you lost your builder
backups.  (Protip: don\'t lose your builder backups).
[min_part_hours] is one of those numbers lost to the builder,
you can change it with set_min_part_hours.'

@staticmethod
def write_builder():

    if exists(builder_file):
        print(('Cowardly    refusing    to    overwrite    existing    Ring    Builder    file:    %s' % builder_file))
        exit(EXIT_ERROR)
    if (len(argv) > 3):
        min_part_hours = int(argv[3])
    else:
        stderr.write('WARNING:    default    min_part_hours    may    not    match    the    value    in    the    lost    builder.\n')
        min_part_hours = 24
    ring = Ring(ring_file)
    for dev in ring.devs:
        if (dev is None):
            continue
        dev.update({'parts': 0, 'parts_wanted': 0})
    builder_dict = {'part_power': (32 - ring._part_shift), 'replicas': float(ring.replica_count), 'min_part_hours': min_part_hours, 'parts': ring.partition_count, 'devs': ring.devs, 'devs_changed': False, 'version': 0, '_replica2part2dev': ring._replica2part2dev_id, '_last_part_moves_epoch': None, '_last_part_moves': None, '_last_part_gather_start': 0, '_remove_devs': []}
    builder = RingBuilder.from_dict(builder_dict)
    for parts in builder._replica2part2dev:
        for dev_id in parts:
            builder.devs[dev_id]['parts'] += 1
    builder.save(builder_file)
