res = ToolRunner.run(jConf, new MySleepJob(), args); } catch (Exception e) { System.out.println("Job failed with" + e.getLocalizedMessage());
@Override public Job createJob(int numMapper, int numReducer, long mapSleepTime, int mapSleepCount, long reduceSleepTime, int reduceSleepCount) throws IOException { Job job = super.createJob(numMapper, numReducer, mapSleepTime, mapSleepCount, reduceSleepTime, reduceSleepCount); job.setMapperClass(MySleepMapper.class); //Populate tokens here because security is disabled. setupBinaryTokenFile(job); return job; }
/** * run a distributed job and verify that TokenCache is available * @throws IOException */ @Test public void testBinaryTokenFile() throws IOException { Configuration conf = mrCluster.getConfig(); // provide namenodes names for the job to get the delegation tokens for final String nnUri = dfsCluster.getURI(0).toString(); conf.set(MRJobConfig.JOB_NAMENODES, nnUri + "," + nnUri); // using argument to pass the file name final String[] args = { "-m", "1", "-r", "1", "-mt", "1", "-rt", "1" }; int res = -1; try { res = ToolRunner.run(conf, new MySleepJob(), args); } catch (Exception e) { System.out.println("Job failed with " + e.getLocalizedMessage()); e.printStackTrace(System.out); fail("Job failed"); } assertEquals("dist job res is not 0:", 0, res); }
@Override public Job createJob(int numMapper, int numReducer, long mapSleepTime, int mapSleepCount, long reduceSleepTime, int reduceSleepCount) throws IOException { Job job = super.createJob(numMapper, numReducer, mapSleepTime, mapSleepCount, reduceSleepTime, reduceSleepCount); job.setMapperClass(MySleepMapper.class); //Populate tokens here because security is disabled. setupBinaryTokenFile(job); return job; }