def parse_resources_args(raw_args):
    """Parse resources args.

    Get the resources.
    Resources are expected to be provided as inputs of the form --resource__{i} where i is the index of the resource.
    `num_resources` is the number of resources provided.
    """
    parser = argparse.ArgumentParser("Olive common args")

    # resources arg
    parser.add_argument("--num_resources", type=int, help="number of resources", required=True)

    args, extra_args = parser.parse_known_args(raw_args)

    if args.num_resources == 0:
        return {}, extra_args

    # parse resources
    parser = argparse.ArgumentParser("Olive resources")
    for i in range(args.num_resources):
        parser.add_argument(f"--resource__{i}", type=str, help=f"resource {i} path", required=True)

    resource_args, extra_args = parser.parse_known_args(extra_args)

    return vars(resource_args), extra_args
Parse resources args.

    Get the resources.
    Resources are expected to be provided as inputs of the form --resource__{i} where i is the index of the resource.
    `num_resources` is the number of resources provided.
    
olive/systems/utils/arg_parser.py