示例#1
0
 /**
  * Checks if is jumbune supplied jar present.
  *
  * @param config the config
  * @return true, if is jumbune supplied jar present
  */
 public static boolean isJumbuneSuppliedJarPresent(Config config) {
   JobConfig jobConfig = (JobConfig) config;
   Master master = jobConfig.getMaster();
   Remoter remoter = new Remoter(master.getHost(), Integer.valueOf(master.getAgentPort()));
   CommandWritableBuilder builder = new CommandWritableBuilder();
   builder.addCommand("ls lib/", false, null, CommandType.FS);
   String result = (String) remoter.fireCommandAndGetObjectResponse(builder.getCommandWritable());
   remoter.close();
   return (result.length() > 0) ? true : false;
 }
示例#2
0
 /**
  * Checks if is mR job jar present.
  *
  * @param config the config
  * @param jarFilepath the jar filepath
  * @return true, if is mR job jar present
  */
 public static boolean isMRJobJarPresent(Config config, String jarFilepath) {
   JobConfig jobConfig = (JobConfig) config;
   Master master = jobConfig.getMaster();
   File resourceDir = new File(jarFilepath);
   if (resourceDir.exists()) {
     Remoter remoter = new Remoter(master.getHost(), Integer.valueOf(master.getAgentPort()));
     CommandWritableBuilder builder = new CommandWritableBuilder();
     builder.addCommand("ls " + jarFilepath, false, null, CommandType.FS);
     String result =
         (String) remoter.fireCommandAndGetObjectResponse(builder.getCommandWritable());
     remoter.close();
     return (result.length() > 0) ? true : false;
   } else {
     return false;
   }
 }