/** * @return {@code null} if no such application exists */ private RunningJob getJob(JobID jobid) throws IOException { try { return jc.getJob(jobid); } catch(IOException ex) { String msg = ex.getMessage(); if(msg != null && (msg.contains("ApplicationNotFoundException") || Pattern.compile("History file.*not found").matcher(msg).find())) { LOG.info("Job(" + jobid + ") not found: " + msg); return null; } throw ex; } }
private RunningJob getRunningJob(MapReduceJob job, JobClient jobClient) throws Exception { RunningJob runningJob = jobClient.getJob(JobID.forName(job.getId())); if (runningJob == null) { throw new Exception(String.format("Failed to retrieve job with id '%s'", job.getId())); } return runningJob; }
private void init(String jobIDStr) { try { jobId = JobID.forName(jobIDStr); rj = jobClient.getJob(jobId); nodeId = AmbroseHiveUtil.getNodeIdFromJob(SessionState.get().getConf(), rj); } catch (IOException e) { LOG.error("Error getting running job for id : " + jobIDStr, e); } }
private void logJob(String logDir, String jobID, PrintWriter listWriter) throws IOException { RunningJob rj = jobClient.getJob(JobID.forName(jobID)); String jobURLString = rj.getTrackingURL();
RunningJob newRj = jc.getJob(rj.getID()); if (newRj == null) {
RunningJob newRj = jc.getJob(rj.getID()); if (newRj == null) {
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
// in the Reducer class... private long mapperCounter; @Override public void configure(JobConf conf) { JobClient client = new JobClient(conf); RunningJob parentJob = client.getJob(JobID.forName( conf.get("mapred.job.id") )); mapperCounter = parentJob.getCounters().getCounter(MAP_COUNTER_NAME); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
/**@deprecated Applications should rather use {@link #getJob(JobID)}. */ @Deprecated public RunningJob getJob(String jobid) throws IOException { return getJob(JobID.forName(jobid)); }
JobClient theJobClient = new JobClient(new InetSocketAddress("your.job.tracker", 8021), new Configuration()); RunningJob theJob = theJobClient.getJob("job_id_string"); // caution, deprecated float mapProgress = theJob.mapProgress(); // similar for reduceProgress // etc (see RunningJob)
private static void killJob(Configuration conf, String jobIdStr, String reason) { LOG.info(reason); // "Kill job because of master is already finished try { org.apache.hadoop.mapred.JobClient jobClient = new org.apache.hadoop.mapred.JobClient( (org.apache.hadoop.mapred.JobConf) conf); JobID jobId = JobID.forName(jobIdStr); RunningJob job = jobClient.getJob(jobId); job.killJob(); } catch (IOException ioe) { throw new GuaguaRuntimeException(ioe); } }
private static void killJob(Configuration conf, String jobIdStr, String reason) { LOG.info(reason); // "Kill job because of master is already finished try { org.apache.hadoop.mapred.JobClient jobClient = new org.apache.hadoop.mapred.JobClient( (org.apache.hadoop.mapred.JobConf) conf); JobID jobId = JobID.forName(jobIdStr); RunningJob job = jobClient.getJob(jobId); job.killJob(); } catch (IOException ioe) { throw new GuaguaRuntimeException(ioe); } }
public void testNonPersistency() throws Exception { startCluster(true, null); JobID jobId = runJob(); JobClient jc = new JobClient(createJobConf()); RunningJob rj = jc.getJob(jobId); assertNotNull(rj); stopCluster(); startCluster(false, null); jc = new JobClient(createJobConf()); rj = jc.getJob(jobId); assertNull(rj); }
public static TaskSummary getSummary(JobClient client, JobID id, boolean searchUntilFound, TwoNestedMap<String, String, Long> counters) throws IOException, InterruptedException { DescriptiveStatistics mapStats = getMapRuntimes(client, id, counters); DescriptiveStatistics reduceStats = getReduceRuntimes(client, id, counters); return getSummary(mapStats, reduceStats, getTaskFailures(new RunningJobFetch(client.getJob(id)), searchUntilFound)); }
public void testGetInvalidJob() throws Exception { RunningJob runJob = new JobClient(getJobConf()).getJob(JobID.forName("job_0_0")); assertNull(runJob); }