本文整理汇总了Java中org.apache.hadoop.mapred.JobInProgress.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java JobInProgress.getStatus方法的具体用法?Java JobInProgress.getStatus怎么用?Java JobInProgress.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapred.JobInProgress
的用法示例。
在下文中一共展示了JobInProgress.getStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateJobTable
import org.apache.hadoop.mapred.JobInProgress; //导入方法依赖的package包/类
/**
* Returns an XML-formatted table of the jobs in the list.
* This is called repeatedly for different lists of jobs (e.g., running, completed, failed).
*/
public void generateJobTable(JspWriter out, String label, List<JobInProgress> jobs)
throws IOException {
if (jobs.size() > 0) {
for (JobInProgress job : jobs) {
JobProfile profile = job.getProfile();
JobStatus status = job.getStatus();
JobID jobid = profile.getJobID();
int desiredMaps = job.desiredMaps();
int desiredReduces = job.desiredReduces();
int completedMaps = job.finishedMaps();
int completedReduces = job.finishedReduces();
String name = profile.getJobName();
out.print("<" + label + "_job jobid=\"" + jobid + "\">\n");
out.print(" <jobid>" + jobid + "</jobid>\n");
out.print(" <user>" + profile.getUser() + "</user>\n");
out.print(" <name>" + ("".equals(name) ? " " : name) + "</name>\n");
out.print(" <map_complete>" + StringUtils.formatPercent(status.mapProgress(), 2) + "</map_complete>\n");
out.print(" <map_total>" + desiredMaps + "</map_total>\n");
out.print(" <maps_completed>" + completedMaps + "</maps_completed>\n");
out.print(" <reduce_complete>" + StringUtils.formatPercent(status.reduceProgress(), 2) + "</reduce_complete>\n");
out.print(" <reduce_total>" + desiredReduces + "</reduce_total>\n");
out.print(" <reduces_completed>" + completedReduces + "</reduces_completed>\n");
out.print("</" + label + "_job>\n");
}
}
}