我正在尝试使用java从特定作业获取所有计数器。。。我已经为hadoop 0.23.1编写了工作代码:
JobClient client = new JobClient(new JobConf(createConfiguration()));
RunningJob job;
system.out.print("Looking for job with title containing the string '" + jobName + "'");
List<JobStatus> jobStatusList = Arrays.asList(client.getAllJobs());
Collections.sort(jobStatusList, new Comparator<JobStatus>() {
@Override
public int compare(JobStatus o1, JobStatus o2) {
return (o1.getStartTime() < o2.getStartTime()) ? 1 : (o1.getStartTime() > o2.getStartTime() ? -1 : 0);
}
});
for (JobStatus jobStatus : jobStatusList) {
job = client.getJob(jobStatus.getJobID());
if (job.getJobName().contains(jobName)) {
system.out.print(String.format("Job Name '%s' was found in job ID: %s...", jobName, jobStatus.getJobID().toString()));
return job.getCounters();
}
}
system.out.print("Did not find job that contains the string '" + jobName + "'. Counters are set to null.");
你知道为什么2.7.1版不起作用吗?
1条答案
按热度按时间mo49yndu1#
rest api成功: