Java 类org.apache.hadoop.mapred.JobTracker.RetireJobInfo 实例源码

项目:hadoop-2.6.0-cdh5.4.3    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hadoop-EAR    文件:JSPUtil.java   
/**
 * Given jobId, resolve the link to jobdetailshistory.jsp
 * @param tracker JobTracker
 * @param jobId JobID
 * @return the link to the page jobdetailshistory.jsp for the job
 */
public static String getJobDetailsHistoryLink(JobTracker tracker,
                                              String jobId) {
  RetireJobInfo info = tracker.retireJobs.get(JobID.forName(jobId));
  String historyFileUrl = getHistoryFileUrl(info);
  String result =  (historyFileUrl == null ? "" :
            "jobdetailshistory.jsp?jobid=" + jobId + "&logFile=" +
            historyFileUrl);
  return result;
}
项目:hadoop-EAR    文件:JSPUtil.java   
/**
 * Given jobId, taskid resolve the link to taskdetailshistory.jsp
 * @param tracker JobTracker
 * @param jobId JobID
 * @param tid String
 * @return the link to the page jobdetailshistory.jsp for the job
 */
public static String getTaskDetailsHistoryLink(JobTracker tracker,
                                               String jobId,
                                               String tid) {
  RetireJobInfo info = tracker.retireJobs.get(JobID.forName(jobId));
  String historyFileUrl = getHistoryFileUrl(info);
  String result =  (historyFileUrl == null ? "" :
            "taskdetailshistory.jsp?jobid=" + jobId + "&logFile=" +
            historyFileUrl + "&taskid=" + tid);
  return result;
}
项目:hadoop-EAR    文件:JSPUtil.java   
/**
 * Obtain history file URL from RetireJobInfo
 * @param info RetireJobInfo
 * @return corresponding history file url, null if cannot creat one
 */
private static String getHistoryFileUrl(RetireJobInfo info) {
  String historyFile = info.getHistoryFile();
  String historyFileUrl = null;
  if (historyFile != null && !historyFile.equals("")) {
    try {
      historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
      LOG.warn("Can't create history url ", e);
    }
  }
  return historyFileUrl;
}
项目:hadoop-EAR    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static void generateRetiredJobXml(JspWriter out, JobTracker tracker, int rowId)
    throws IOException {

  Iterator<RetireJobInfo> iterator =
    tracker.retireJobs.getAll().descendingIterator();

  for (int i = 0; i < 100 && iterator.hasNext(); i++) {
    RetireJobInfo info = iterator.next();
    JobStatus status = info.status;
    StringBuilder sb = new StringBuilder();
    sb.append("<retired_job rowid=\"" + rowId + "\" jobid=\"" + status.getJobId() + "\">");
    sb.append("<jobid>" + status.getJobId() + "</jobid>");
    sb.append("<history_url>jobdetailshistory.jsp?jobid=" + status.getJobId()
        + "&amp;logFile="
        + URLEncoder.encode(info.getHistoryFile().toString(), "UTF-8")
        + "</history_url>");
    sb.append("<priority>" + status.getJobPriority().toString()
        + "</priority>");
    sb.append("<user>" + info.profile.getUser() + "</user>");
    sb.append("<name>" + info.profile.getJobName() + "</name>");
    sb.append("<run_state>" + JobStatus.getJobRunState(status.getRunState())
        + "</run_state>");
    sb.append("<start_time>" + new Date(status.getStartTime())
        + "</start_time>");
    sb.append("<finish_time>" + new Date(info.finishTime)
        + "</finish_time>");
    sb.append("<map_complete>" + StringUtils.formatPercent(
        status.mapProgress(), 2) + "</map_complete>");
    sb.append("<reduce_complete>" + StringUtils.formatPercent(
        status.reduceProgress(), 2) + "</reduce_complete>");
    sb.append("<scheduling_info>" + status.getSchedulingInfo() + "</scheduling_info>");
    sb.append("</retired_job>\n");
    out.write(sb.toString());
    rowId++;
  }
}
项目:hadoop-EAR    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hadoop-on-lustre    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:RDFS    文件:JSPUtil.java   
/**
 * Given jobId, resolve the link to jobdetailshistory.jsp
 * @param tracker JobTracker
 * @param jobId JobID
 * @return the link to the page jobdetailshistory.jsp for the job
 */
public static String getJobDetailsHistoryLink(JobTracker tracker,
                                              String jobId) {
  RetireJobInfo info = tracker.retireJobs.get(JobID.forName(jobId));
  String historyFileUrl = getHistoryFileUrl(info);
  String result =  (historyFileUrl == null ? "" :
            "jobdetailshistory.jsp?jobid=" + jobId + "&logFile=" +
            historyFileUrl);
  return result;
}
项目:RDFS    文件:JSPUtil.java   
/**
 * Given jobId, taskid resolve the link to taskdetailshistory.jsp
 * @param tracker JobTracker
 * @param jobId JobID
 * @param tid String
 * @return the link to the page jobdetailshistory.jsp for the job
 */
public static String getTaskDetailsHistoryLink(JobTracker tracker,
                                               String jobId,
                                               String tid) {
  RetireJobInfo info = tracker.retireJobs.get(JobID.forName(jobId));
  String historyFileUrl = getHistoryFileUrl(info);
  String result =  (historyFileUrl == null ? "" :
            "taskdetailshistory.jsp?jobid=" + jobId + "&logFile=" +
            historyFileUrl + "&taskid=" + tid);
  return result;
}
项目:RDFS    文件:JSPUtil.java   
/**
 * Obtain history file URL from RetireJobInfo
 * @param info RetireJobInfo
 * @return corresponding history file url, null if cannot creat one
 */
private static String getHistoryFileUrl(RetireJobInfo info) {
  String historyFile = info.getHistoryFile();
  String historyFileUrl = null;
  if (historyFile != null && !historyFile.equals("")) {
    try {
      historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
      LOG.warn("Can't create history url ", e);
    }
  }
  return historyFileUrl;
}
项目:RDFS    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static void generateRetiredJobXml(JspWriter out, JobTracker tracker, int rowId)
    throws IOException {

  Iterator<RetireJobInfo> iterator =
    tracker.retireJobs.getAll().descendingIterator();

  for (int i = 0; i < 100 && iterator.hasNext(); i++) {
    RetireJobInfo info = iterator.next();
    JobStatus status = info.status;
    StringBuilder sb = new StringBuilder();
    sb.append("<retired_job rowid=\"" + rowId + "\" jobid=\"" + status.getJobId() + "\">");
    sb.append("<jobid>" + status.getJobId() + "</jobid>");
    sb.append("<history_url>jobdetailshistory.jsp?jobid=" + status.getJobId()
        + "&amp;logFile="
        + URLEncoder.encode(info.getHistoryFile().toString(), "UTF-8")
        + "</history_url>");
    sb.append("<priority>" + status.getJobPriority().toString()
        + "</priority>");
    sb.append("<user>" + info.profile.getUser() + "</user>");
    sb.append("<name>" + info.profile.getJobName() + "</name>");
    sb.append("<run_state>" + JobStatus.getJobRunState(status.getRunState())
        + "</run_state>");
    sb.append("<start_time>" + new Date(status.getStartTime())
        + "</start_time>");
    sb.append("<finish_time>" + new Date(info.finishTime)
        + "</finish_time>");
    sb.append("<map_complete>" + StringUtils.formatPercent(
        status.mapProgress(), 2) + "</map_complete>");
    sb.append("<reduce_complete>" + StringUtils.formatPercent(
        status.reduceProgress(), 2) + "</reduce_complete>");
    sb.append("<scheduling_info>" + status.getSchedulingInfo() + "</scheduling_info>");
    sb.append("</retired_job>\n");
    out.write(sb.toString());
    rowId++;
  }
}
项目:RDFS    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hanoi-hadoop-2.0.0-cdh    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hortonworks-extension    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hortonworks-extension    文件:TestJobRetire.java   
private JobID validateJobRetire(JobConf jobConf, Path inDir, Path outDir,
    JobTracker jobtracker) throws IOException {

  RunningJob rj = UtilsForTests.runJob(jobConf, inDir, outDir, 0, 0);
  rj.waitForCompletion();
  assertTrue(rj.isSuccessful());
  JobID id = rj.getID();

  //wait for job to get retired
  waitTillRetire(id, jobtracker);
  RetireJobInfo retired = jobtracker.retireJobs.get(id);
  assertTrue("History url not set", retired.getHistoryFile() != null &&
    retired.getHistoryFile().length() > 0);
  assertNotNull("Job is not in cache", jobtracker.getJobStatus(id));

  // get the job conf filename
  String name = jobtracker.getLocalJobFilePath(id);
  File file = new File(name);

  assertFalse("JobConf file not deleted", file.exists());
  //test redirection
  URL jobUrl = new URL(rj.getTrackingURL());
  HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
  conn.setInstanceFollowRedirects(false);
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
  conn.disconnect();

  URL redirectedUrl = new URL(conn.getHeaderField("Location"));
  conn = (HttpURLConnection) redirectedUrl.openConnection();
  conn.connect();
  assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
  conn.disconnect();

  return id;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"sortable\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") + 

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:hadoop-EAR    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId)
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"tablesorter\">\n");

  Iterator<RetireJobInfo> iterator =
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><th align=\"center\" colspan=\"8\"><i>none</i>" +
    "</th></tr>\n");
  } else {
    sb.append("<thead><tr>");

    sb.append("<th><b>Jobid</b></th>");
    sb.append("<th><b>Priority</b></th>");
    sb.append("<th><b>User</b></th>");
    sb.append("<th><b>Name</b></th>");
    sb.append("<th><b>State</b></th>");
    sb.append("<th><b>Start Time</b></th>");
    sb.append("<th><b>Finish Time</b></th>");
    sb.append("<th><b>Map % Complete</b></th>");
    sb.append("<th><b>Reduce % Complete</b></th>");
    sb.append("<th><b>Job Scheduling Information</b></th>");
    sb.append("</tr></thead><tbody>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFileUrl = getHistoryFileUrl(info);
      sb.append("<tr>");

      String name = info.profile.getJobName();
      String abbreviatedName
          = (name.length() > 76 ? name.substring(0,76) + "..." : name);

      sb.append(
          "<td id=\"job_" + rowId + "\">" +

            (historyFileUrl == null ? "" :
            "<a href=\"jobdetailshistory.jsp?jobid=" +
            info.status.getJobId() + "&logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" +
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" + info.profile.getUser()
            + "</td>" +
          "<td id=\"name_" + rowId + "\">" + abbreviatedName
            + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState())
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) +
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) +
            "</td>" +

          "<td>" + info.status.getSchedulingInfo() + "</td>" +

          "</tr>\n");
      rowId++;
    }
    sb.append("</tbody>");
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:hadoop-on-lustre    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"" + JobHistoryServer.getHistoryUrlPrefix(tracker.conf) +
                "/jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:RDFS    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId)
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"tablesorter\">\n");

  Iterator<RetireJobInfo> iterator =
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><th align=\"center\" colspan=\"8\"><i>none</i>" +
    "</th></tr>\n");
  } else {
    sb.append("<thead><tr>");

    sb.append("<th><b>Jobid</b></th>");
    sb.append("<th><b>Priority</b></th>");
    sb.append("<th><b>User</b></th>");
    sb.append("<th><b>Name</b></th>");
    sb.append("<th><b>State</b></th>");
    sb.append("<th><b>Start Time</b></th>");
    sb.append("<th><b>Finish Time</b></th>");
    sb.append("<th><b>Map % Complete</b></th>");
    sb.append("<th><b>Reduce % Complete</b></th>");
    sb.append("<th><b>Job Scheduling Information</b></th>");
    sb.append("</tr></thead><tbody>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFileUrl = getHistoryFileUrl(info);
      sb.append("<tr>");

      String name = info.profile.getJobName();
      String abbreviatedName
          = (name.length() > 76 ? name.substring(0,76) + "..." : name);

      sb.append(
          "<td id=\"job_" + rowId + "\">" +

            (historyFileUrl == null ? "" :
            "<a href=\"jobdetailshistory.jsp?jobid=" +
            info.status.getJobId() + "&logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" +
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" + info.profile.getUser()
            + "</td>" +
          "<td id=\"name_" + rowId + "\">" + abbreviatedName
            + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState())
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) +
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) +
            "</td>" +

          "<td>" + info.status.getSchedulingInfo() + "</td>" +

          "</tr>\n");
      rowId++;
    }
    sb.append("</tbody>");
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:hanoi-hadoop-2.0.0-cdh    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"sortable\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") + 

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:mammoth    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"" + JobHistoryServer.getHistoryUrlPrefix(tracker.conf) +
                "/jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:hortonworks-extension    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"" + JobHistoryServer.getHistoryUrlPrefix(tracker.conf) +
                "/jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}
项目:hortonworks-extension    文件:JSPUtil.java   
@SuppressWarnings("unchecked")
public static String generateRetiredJobTable(JobTracker tracker, int rowId) 
  throws IOException {

  StringBuffer sb = new StringBuffer();
  sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n");

  Iterator<RetireJobInfo> iterator = 
    tracker.retireJobs.getAll().descendingIterator();
  if (!iterator.hasNext()) {
    sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" +
    "</td></tr>\n");
  } else {
    sb.append("<tr>");

    sb.append("<td><b>Jobid</b></td>");
    sb.append("<td><b>Priority</b></td>");
    sb.append("<td><b>User</b></td>");
    sb.append("<td><b>Name</b></td>");
    sb.append("<td><b>State</b></td>");
    sb.append("<td><b>Start Time</b></td>");
    sb.append("<td><b>Finish Time</b></td>");
    sb.append("<td><b>Map % Complete</b></td>");
    sb.append("<td><b>Reduce % Complete</b></td>");
    sb.append("<td><b>Job Scheduling Information</b></td>");
    sb.append("<td><b>Diagnostic Info </b></td>");
    sb.append("</tr>\n");
    for (int i = 0; i < 100 && iterator.hasNext(); i++) {
      RetireJobInfo info = iterator.next();
      String historyFile = info.getHistoryFile();
      String historyFileUrl = null;
      if (historyFile != null && !historyFile.equals("")) {
        try {
          historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
          LOG.warn("Can't create history url ", e);
        }
      }
      sb.append("<tr>");
      sb.append(
          "<td id=\"job_" + rowId + "\">" + 

            (historyFileUrl == null ? "" :
            "<a href=\"" + JobHistoryServer.getHistoryUrlPrefix(tracker.conf) +
                "/jobdetailshistory.jsp?logFile=" + historyFileUrl + "\">") +

            info.status.getJobId() + "</a></td>" +

          "<td id=\"priority_" + rowId + "\">" + 
            info.status.getJobPriority().toString() + "</td>" +
          "<td id=\"user_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getUser()) + "</td>" +
          "<td id=\"name_" + rowId + "\">" +
            HtmlQuoting.quoteHtmlChars(info.profile.getJobName()) + "</td>" +
          "<td>" + JobStatus.getJobRunState(info.status.getRunState()) 
            + "</td>" +
          "<td>" + new Date(info.status.getStartTime()) + "</td>" +
          "<td>" + new Date(info.finishTime) + "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.mapProgress(), 2)
          + ServletUtil.percentageGraph(info.status.mapProgress() * 100, 80) + 
            "</td>" +

          "<td>" + StringUtils.formatPercent(info.status.reduceProgress(), 2)
          + ServletUtil.percentageGraph(
             info.status.reduceProgress() * 100, 80) + 
            "</td>" +

          "<td>" +
          HtmlQuoting.quoteHtmlChars(info.status.getSchedulingInfo()) +
          "</td>" + 
          "<td>" + HtmlQuoting.quoteHtmlChars(info.status.getFailureInfo()) + 
          "</td></tr>\n");
      rowId++;
    }
  }
  sb.append("</table>\n");
  return sb.toString();
}