/** * Get all the jobs submitted. */ public JobStatus[] getAllJobs() throws IOException { return jc.getAllJobs(); }
/** * Get all the jobs submitted. */ public JobStatus[] getAllJobs() throws IOException { return jc.getAllJobs(); }
/** * Get all the jobs submitted. */ public JobStatus[] getAllJobs() throws IOException { return jc.getAllJobs(); }
/** * Get all the jobs submitted. */ public JobStatus[] getAllJobs() throws IOException { return jc.getAllJobs(); }
/** * Get all the jobs submitted. */ public JobStatus[] getAllJobs() throws IOException { return jc.getAllJobs(); }
/** * Dump a list of all jobs submitted. * @throws IOException */ private void listAllJobs() throws IOException { JobStatus[] jobs = getAllJobs(); if (jobs == null) jobs = new JobStatus[0]; System.out.printf("%d jobs submitted\n", jobs.length); System.out.printf("States are:\n\tRunning : 1\tSucceded : 2" + "\tFailed : 3\tPrep : 4\n"); displayJobList(jobs); }
/** * Dump a list of all jobs submitted. * @throws IOException */ private void listAllJobs() throws IOException { JobStatus[] jobs = getAllJobs(); if (jobs == null) jobs = new JobStatus[0]; System.out.printf("%d jobs submitted\n", jobs.length); System.out.printf("States are:\n\tRunning : 1\tSucceded : 2" + "\tFailed : 3\tPrep : 4\n"); displayJobList(jobs); }
/** * Get the jobs that are not completed and not failed. * * @return array of {@link JobStatus} for the running/to-be-run jobs. * @throws IOException */ public JobStatus[] jobsToComplete() throws IOException { List<JobStatus> stats = new ArrayList<JobStatus>(); for (JobStatus stat : getAllJobs()) { if (!stat.isJobComplete()) { stats.add(stat); } } return stats.toArray(new JobStatus[0]); }
/** * Get the jobs that are not completed and not failed. * * @return array of {@link JobStatus} for the running/to-be-run jobs. * @throws IOException */ public JobStatus[] jobsToComplete() throws IOException { List<JobStatus> stats = new ArrayList<JobStatus>(); for (JobStatus stat : getAllJobs()) { if (!stat.isJobComplete()) { stats.add(stat); } } return stats.toArray(new JobStatus[0]); }
/** * Get the jobs that are not completed and not failed. * * @return array of {@link JobStatus} for the running/to-be-run jobs. * @throws IOException */ public JobStatus[] jobsToComplete() throws IOException { List<JobStatus> stats = new ArrayList<JobStatus>(); for (JobStatus stat : getAllJobs()) { if (!stat.isJobComplete()) { stats.add(stat); } } return stats.toArray(new JobStatus[0]); }
/** * Get the jobs that are not completed and not failed. * * @return array of {@link JobStatus} for the running/to-be-run jobs. * @throws IOException */ public JobStatus[] jobsToComplete() throws IOException { List<JobStatus> stats = new ArrayList<JobStatus>(); for (JobStatus stat : getAllJobs()) { if (!stat.isJobComplete()) { stats.add(stat); } } return stats.toArray(new JobStatus[0]); }
/** * Get the jobs that are not completed and not failed. * * @return array of {@link JobStatus} for the running/to-be-run jobs. * @throws IOException */ public JobStatus[] jobsToComplete() throws IOException { List<JobStatus> stats = new ArrayList<JobStatus>(); for (JobStatus stat : getAllJobs()) { if (!stat.isJobComplete()) { stats.add(stat); } } return stats.toArray(new JobStatus[0]); }
/** * Gets job status from the jobtracker given the jobclient and the job id */ static JobStatus getJobStatus(JobClient jc, JobID id) throws IOException { JobStatus[] statuses = jc.getAllJobs(); for (JobStatus jobStatus : statuses) { if (jobStatus.getJobID().equals(id)) { return jobStatus; } } return null; }
Configuration conf = new Configuration(); conf.addResource(new Path(hadoopConfPath + "core-site.xml")); conf.addResource(new Path(hadoopConfPath + "hdfs-site.xml")); conf.addResource(new Path(hadoopConfPath + "mapred-site.xml")); InetSocketAddress jobtracker = new InetSocketAddress(jobTrackerHost, jobTrackerPort); JobClient jobClient = new JobClient(jobtracker, conf); jobClient.setConf(conf); JobStatus[] jobs = jobClient.getAllJobs(); for (int i = 0; i < jobs.length; i++) { JobStatus js = jobs[i]; JobID job1 = js.getJobID();
JobClient client = new JobClient(getConf()); for (JobStatus job : client.getAllJobs()) { if (job.isJobComplete()) { Stirng jobName = job.getJobName(); int jobStatus = job.getJobStatus(); // .. you get the idea } }
/** * Gets job status from the jobtracker given the jobclient and the job id */ static JobStatus getJobStatus(JobClient jc, JobID id) throws IOException { JobStatus[] statuses = jc.getAllJobs(); for (JobStatus jobStatus : statuses) { if (jobStatus.getJobID().equals(id)) { return jobStatus; } } return null; }
/** * Waits until all the jobs at the jobtracker complete. */ static void waitTillDone(JobClient jobClient) throws IOException { // Wait for the last job to complete while (true) { boolean shouldWait = false; for (JobStatus jobStatuses : jobClient.getAllJobs()) { if (jobStatuses.getRunState() != JobStatus.SUCCEEDED && jobStatuses.getRunState() != JobStatus.FAILED && jobStatuses.getRunState() != JobStatus.KILLED) { shouldWait = true; break; } } if (shouldWait) { waitFor(100); } else { break; } } }
/** * @param runId for which information will be returned. * @return a {@link MRJobInfo} containing information about a particular MapReduce program run. * @throws IOException if there is failure to communicate through the JobClient. * @throws NotFoundException if a Job with the given runId is not found. */ @Override public MRJobInfo getMRJobInfo(Id.Run runId) throws IOException, NotFoundException { Preconditions.checkArgument(ProgramType.MAPREDUCE.equals(runId.getProgram().getType())); JobClient jobClient = new JobClient(hConf); JobStatus[] jobs = jobClient.getAllJobs(); JobStatus thisJob = findJobForRunId(jobs, runId.toEntityId()); RunningJob runningJob = jobClient.getJob(thisJob.getJobID()); if (runningJob == null) { throw new IllegalStateException(String.format("JobClient returned null for RunId: '%s', JobId: '%s'", runId, thisJob.getJobID())); } Counters counters = runningJob.getCounters(); TaskReport[] mapTaskReports = jobClient.getMapTaskReports(thisJob.getJobID()); TaskReport[] reduceTaskReports = jobClient.getReduceTaskReports(thisJob.getJobID()); return new MRJobInfo(runningJob.mapProgress(), runningJob.reduceProgress(), groupToMap(counters.getGroup(TaskCounter.class.getName())), toMRTaskInfos(mapTaskReports), toMRTaskInfos(reduceTaskReports), true); }
/** * Waits until all the jobs at the jobtracker complete. */ static void waitTillDone(JobClient jobClient) throws IOException { // Wait for the last job to complete while (true) { boolean shouldWait = false; for (JobStatus jobStatuses : jobClient.getAllJobs()) { if (jobStatuses.getRunState() != JobStatus.SUCCEEDED && jobStatuses.getRunState() != JobStatus.FAILED && jobStatuses.getRunState() != JobStatus.KILLED) { shouldWait = true; break; } } if (shouldWait) { waitFor(100); } else { break; } } }
public void testCreateJobClient() throws Exception { HadoopAccessorService has = Services.get().get(HadoopAccessorService.class); Configuration conf = has.createConfiguration(getJobTrackerUri()); JobClient jc = has.createJobClient(getTestUser(), conf); assertNotNull(jc); jc.getAllJobs(); JobConf conf2 = new JobConf(false); conf2.set("mapred.job.tracker", getJobTrackerUri()); try { has.createJobClient(getTestUser(), conf2); fail("Should have thrown exception because Configuration not created by HadoopAccessorService"); } catch (HadoopAccessorException ex) { assertEquals(ErrorCode.E0903, ex.getErrorCode()); } }