List of usage examples for org.apache.hadoop.util RunJar main
public static void main(String[] args) throws Throwable
From source file:io.aos.mapreduce.MapReduceJarRunner.java
License:Apache License
public static void main(final String... args) throws Exception { // File jarFolder = new File(System.getenv("HADOOP_HOME") + "/share/hadoop/mapreduce/"); File jarFolder = new File("./target"); final File[] jar = jarFolder.listFiles(new FileFilter() { @Override//from w w w .jav a2s . c om public boolean accept(File pathname) { return pathname.getName().endsWith("SNAPSHOT.jar"); } }); if (jar.length != 1) { throw new IllegalStateException("Can't find any jar in " + jarFolder); } new AosProcessLauncher() { @Override public void process() throws Exception { try { String[] rjArgs = new String[args.length + 2]; rjArgs[0] = jar[0].getAbsolutePath(); rjArgs[1] = args[0]; System.arraycopy(args, 0, rjArgs, 2, args.length); System.out.println(rjArgs); RunJar.main(rjArgs); } catch (Throwable t) { throw new Exception(t); } } }.launch("MapReduce"); while (true) { LOGGER.info("Sleeping..."); TimeUnit.MINUTES.sleep(1); } }
From source file:org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.NativeMapReduceOper.java
License:Apache License
public void runJob() throws JobCreationException { RunJarSecurityManager secMan = new RunJarSecurityManager(); try {/*from ww w .j a v a 2 s . com*/ RunJar.main(getNativeMRParams()); MRPigStatsUtil.addNativeJobStats(PigStats.get(), this, true); } catch (SecurityException se) { if (secMan.getExitInvoked()) { if (secMan.getExitCode() != 0) { throw new JobCreationException("Native job returned with non-zero return code"); } else { MRPigStatsUtil.addNativeJobStats(PigStats.get(), this, true); } } } catch (Throwable t) { JobCreationException e = new JobCreationException("Cannot run native mapreduce job " + t.getMessage(), t); MRPigStatsUtil.addNativeJobStats(PigStats.get(), this, false, e); throw e; } finally { secMan.retire(); } }
From source file:org.apache.pig.backend.hadoop.executionengine.tez.NativeTezOper.java
License:Apache License
public void runJob() throws JobCreationException { RunJarSecurityManager secMan = new RunJarSecurityManager(); try {/*from ww w . ja va2 s. c o m*/ RunJar.main(getNativeTezParams()); ((TezStats) PigStats.get()).addTezJobStatsForNative(this, true); } catch (SecurityException se) { if (secMan.getExitInvoked()) { if (secMan.getExitCode() != 0) { throw new JobCreationException("Native job returned with non-zero return code"); } else { ((TezStats) PigStats.get()).addTezJobStatsForNative(this, true); } } } catch (Throwable t) { JobCreationException e = new JobCreationException("Cannot run native tez job " + t.getMessage(), t); ((TezStats) PigStats.get()).addTezJobStatsForNative(this, false); throw e; } finally { secMan.retire(); } }
From source file:org.apache.pig.backend.hadoop.executionengine.tez.plan.operator.NativeTezOper.java
License:Apache License
public void runJob(String jobStatsKey) throws JobCreationException { RunJarSecurityManager secMan = new RunJarSecurityManager(); try {/*from ww w .ja va 2s .co m*/ RunJar.main(getNativeTezParams()); ((TezPigScriptStats) PigStats.get()).addTezJobStatsForNative(jobStatsKey, this, true); } catch (SecurityException se) { if (secMan.getExitInvoked()) { if (secMan.getExitCode() != 0) { throw new JobCreationException("Native job returned with non-zero return code"); } else { ((TezPigScriptStats) PigStats.get()).addTezJobStatsForNative(jobStatsKey, this, true); } } } catch (Throwable t) { JobCreationException e = new JobCreationException("Cannot run native tez job " + t.getMessage(), t); ((TezPigScriptStats) PigStats.get()).addTezJobStatsForNative(jobStatsKey, this, false); throw e; } finally { secMan.retire(); } }