def create_parser(subparsers, for_python=False): ''' Create a subparser for the submit command :param subparsers: :return: ''' parser = subparsers.add_parser( 'submit', help='Submit a job', usage="%(prog)s cluster " + \ "job-type job-file-name job-class-name [job-args]", add_help=True ) cli_args.add_titles(parser) cli_args.add_cluster_role_env(parser) cli_args.add_job_type(parser) cli_args.add_job_file(parser) if not for_python: cli_args.add_job_class(parser) cli_args.add_verbose(parser) cli_args.add_debug(parser) parser.set_defaults(subcommand='submit') return parser
def create_parser(subparsers, action, help_arg): ''' :param subparsers: :param action: :param help_arg: :return: ''' parser = subparsers.add_parser(action, help=help_arg, usage="%(prog)s [options] cluster <job-id>", add_help=True) args.add_titles(parser) args.add_cluster_role_env(parser) args.add_job(parser) args.add_config(parser) args.add_verbose(parser) parser.set_defaults(subcommand=action) return parser