res = ToolRunner.run(jConf, new MySleepJob(), args); } catch (Exception e) { System.out.println("Job failed with" + e.getLocalizedMessage());
/** * run a local job and verify that TokenCache is available * @throws NoSuchAlgorithmException * @throws IOException */ @Test public void testLocalJobTokenCache() throws NoSuchAlgorithmException, IOException { System.out.println("running local job"); // this is local job String[] args = {"-m", "1", "-r", "1", "-mt", "1", "-rt", "1"}; jConf.set("mapreduce.job.credentials.json", tokenFileName.toString()); int res = -1; try { res = ToolRunner.run(jConf, new MySleepJob(), args); } catch (Exception e) { System.out.println("Job failed with" + e.getLocalizedMessage()); e.printStackTrace(System.out); fail("local Job failed"); } assertEquals("local job res is not 0", res, 0); }
@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. populateTokens(job); return job; }