def main()

in FSxL-Compression/fsx_lustre_migrate_files.py [0:0]


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--migrate-path", help="Path to directory where files will be rewritten with lfs migrate command. Must be a path under Lustre mount point. Default to be /fsx",
                        default=DEFAULT_MOUNT_POINT)
    parser.add_argument("--concurrency", help="Number of concurrent threads to issue lfs migrate. Default to be the number of CPU cores.",
                        default=DEFAULT_CONCURRENCY)
    parser.add_argument("--manifest-input-path", help="Optional input path to a manifest file that contains a list of file paths that the script will migrate.")
    parser.add_argument("--manifest-output-path", help="Override the path where the script writes the file list under given migrate-path. By default the script writes to a temp file at path /tmp/lfs_migrate_manifest.TIMESTAMP.",
                        default=DEFAULT_MANIFEST_OUTPUT)
    args = parser.parse_args()

    # Logging
    logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] %(name)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S %Z')
    logger.info("Using migrate path: %s", args.migrate_path)
    logger.info("Using concurrency: %d", args.concurrency)
    if args.manifest_input_path:
        logger.info("Using manifest input path: %s", args.manifest_input_path)
        if not os.path.isfile(args.manifest_input_path):
            sys.exit("Input file path does not exist: " + args.manifest_input_path)
    else:
        # --manifest-output-path is ignored if --manifest-input-path is specified
        logger.info("Using manifest output path: %s", args.manifest_output_path)

    lfs_migrate_at_path(args)