@Test public void testParseYarnWithoutOptions() { String[] args = {"yarn"}; List<String> commandOptions = PythonShellParser.parseYarn(args); String[] expectedCommandOptions = {"yarn", "-m", "yarn-cluster"}; Assert.assertArrayEquals(expectedCommandOptions, commandOptions.toArray()); }
static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; }
PythonShellParser { static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; } }
PythonShellParser { static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; }  }
PythonShellParser { static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; }  static void main(String[] args); }
PythonShellParser { static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; }  static void main(String[] args);  }