Beispiel #1
0
  private List<String> makeArgs(
      String jar,
      String mainClass,
      String libjars,
      String files,
      List<String> jarArgs,
      List<String> defines,
      String statusdir,
      String completedUrl)
      throws BadParam, IOException, InterruptedException {
    ArrayList<String> args = new ArrayList<String>();
    try {
      ArrayList<String> allFiles = new ArrayList();
      allFiles.add(TempletonUtils.hadoopFsFilename(jar, appConf, runAs));

      args.addAll(makeLauncherArgs(appConf, statusdir, completedUrl, allFiles));
      args.add("--");
      args.add(appConf.clusterHadoop());
      args.add("jar");
      args.add(TempletonUtils.hadoopFsPath(jar, appConf, runAs).getName());
      if (TempletonUtils.isset(mainClass)) args.add(mainClass);
      if (TempletonUtils.isset(libjars)) {
        args.add("-libjars");
        args.add(TempletonUtils.hadoopFsListAsString(libjars, appConf, runAs));
      }
      if (TempletonUtils.isset(files)) {
        args.add("-files");
        args.add(TempletonUtils.hadoopFsListAsString(files, appConf, runAs));
      }
      // the token file location comes after mainClass, as a -Dprop=val
      args.add("-D" + TempletonControllerJob.TOKEN_FILE_ARG_PLACEHOLDER);

      for (String d : defines) args.add("-D" + d);

      args.addAll(jarArgs);
    } catch (FileNotFoundException e) {
      throw new BadParam(e.getMessage());
    } catch (URISyntaxException e) {
      throw new BadParam(e.getMessage());
    }

    return args;
  }