def main()

in modules/python/fio/fio.py [0:0]


def main():
    parser = argparse.ArgumentParser(description="Fio Benchmark.")
    subparsers = parser.add_subparsers(dest="command")

    # Sub-command for validate
    parser_validate = subparsers.add_parser("validate", help="Validate node count")
    parser_validate.add_argument("node_count", type=int, help="Number of nodes")
    parser_validate.add_argument("operation_timeout", type=int, help="Timeout for the operation in seconds")

    # Sub-command for configure
    parser_configure = subparsers.add_parser("configure", help="Configure fio benchmark")
    parser_configure.add_argument("yaml_path", type=str, help="Path to the YAML file")
    parser_configure.add_argument("replicas", type=int, help="Number of replicas")
    parser_configure.add_argument("operation_timeout", type=int, help="Timeout for the operation in seconds")

    # Sub-command for execute_attach_detach
    parser_execute = subparsers.add_parser("execute", help="Execute fio benchmark")
    parser_execute.add_argument("block_size", type=str, help="Block size")
    parser_execute.add_argument("iodepth", type=int, help="IO depth")
    parser_execute.add_argument("method", type=str, help="Method")
    parser_execute.add_argument("runtime", type=int, help="Runtime in seconds")
    parser_execute.add_argument("result_dir", type=str, help="Directory to store results")

    # Sub-command for collect_attach_detach
    parser_collect = subparsers.add_parser("collect", help="Collect attach detach test results")
    parser_collect.add_argument("vm_size", type=str, help="VM size")
    parser_collect.add_argument("block_size", type=str, help="Block size")
    parser_collect.add_argument("iodepth", type=int, help="IO depth")
    parser_collect.add_argument("method", type=str, help="Method")
    parser_collect.add_argument("result_dir", type=str, help="Directory to store results")
    parser_collect.add_argument("run_url", type=str, help="Run URL")
    parser_collect.add_argument("cloud_info", type=str, help="Cloud information")

    args = parser.parse_args()
    if args.command == "validate":
        validate(args.node_count, args.operation_timeout)
    elif args.command == "configure":
        configure(args.yaml_path, args.replicas, args.operation_timeout)
    elif args.command == "execute":
        execute(args.block_size, args.iodepth, args.method, args.runtime, args.result_dir)
    elif args.command == "collect":
        collect(args.vm_size, args.block_size, args.iodepth, args.method,
                args.result_dir, args.run_url, args.cloud_info)