chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r763385 - in /hadoop/chukwa/trunk: ./ src/web/hicc/css/flexigrid/images/ src/web/hicc/descriptors/ src/web/hicc/js/workspace/ src/web/hicc/jsp/
Date Wed, 08 Apr 2009 20:47:04 GMT
Author: eyang
Date: Wed Apr  8 20:47:03 2009
New Revision: 763385

URL: http://svn.apache.org/viewvc?rev=763385&view=rev
Log:
CHUKWA-61.  Added report widget for accounting information. (Eric Yang)


Added:
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/bg.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/btn-sprite.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/ddn.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/dn.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/fhbg.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/first.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/hl.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/last.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/line.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/magnifier.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/next.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/prev.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/up.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/uup.png   (with props)
    hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/wbg.gif   (with props)
    hadoop/chukwa/trunk/src/web/hicc/descriptors/utilization.descriptor
    hadoop/chukwa/trunk/src/web/hicc/jsp/job_viewer.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/jobs_viewer.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/table_viewer.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/util.jsp
Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/web/hicc/js/workspace/workspace.js

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=763385&r1=763384&r2=763385&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Wed Apr  8 20:47:03 2009
@@ -69,6 +69,10 @@
 
   BUG FIXES
 
+    CHUKWA-61.  Added report widget for accounting information. (Eric Yang)
+
+    CHUKWA-77.  Added Database Schema for Hadoop accounting information. (Eric Yang)
+
     CHUKWA-92.  AbstractMetricsContext was using the wrong value (Jerome Boulon via asrabkin)
 
     CHUKWA-70.  Rewrite FileAdaptor.  (Jerome Boulon via asrabkin)

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/bg.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/bg.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/bg.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/btn-sprite.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/btn-sprite.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/btn-sprite.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/btn-sprite.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/ddn.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/ddn.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/ddn.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/ddn.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/dn.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/dn.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/dn.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/dn.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/fhbg.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/fhbg.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/fhbg.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/fhbg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/first.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/first.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/first.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/first.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/hl.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/hl.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/hl.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/hl.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/last.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/last.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/last.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/last.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/line.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/line.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/line.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/line.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/load.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/magnifier.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/magnifier.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/magnifier.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/magnifier.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/next.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/next.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/next.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/next.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/prev.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/prev.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/prev.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/prev.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/up.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/up.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/up.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/up.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/uup.png
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/uup.png?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/uup.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/uup.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/wbg.gif
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/wbg.gif?rev=763385&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/wbg.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: hadoop/chukwa/trunk/src/web/hicc/css/flexigrid/images/wbg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: hadoop/chukwa/trunk/src/web/hicc/descriptors/utilization.descriptor
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/descriptors/utilization.descriptor?rev=763385&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/descriptors/utilization.descriptor (added)
+++ hadoop/chukwa/trunk/src/web/hicc/descriptors/utilization.descriptor Wed Apr  8 20:47:03
2009
@@ -0,0 +1,30 @@
+{
+"id":"utilization",
+"title":"Utilization",
+"version":"0.1",
+"categories":"Accounting,Utilities",
+"module":"iframe\/jsp\/table_viewer.jsp",
+"description":"Display Queue/User utilization of the hadoop cluter",
+"screendump":"",
+"refresh":"0",
+"parameters":[
+{"name":"report","type":"string","value":"/hicc/jsp/util.jsp","edit":"0"},
+{"name":"column","type":"string","value":"Queue","edit":"0"},
+{"name":"column","type":"string","value":"HDFS Usage Bytes (Per Hour)","edit":"0"},
+{"name":"column","type":"string","value":"Slot Hours (Per Hour)","edit":"0"},
+{"name":"columnSize","type":"string","value":"200","edit":"0"},
+{"name":"columnSize","type":"string","value":"200","edit":"0"},
+{"name":"columnSize","type":"string","value":"200","edit":"0"},
+{"name":"columnAlign","type":"string","value":"left","edit":"0"},
+{"name":"columnAlign","type":"string","value":"right","edit":"0"},
+{"name":"columnAlign","type":"string","value":"right","edit":"0"},
+{"name":"height","type":"select","value":"600","label":"Height","options":[
+{"label":"200","value":"200"},
+{"label":"400","value":"400"},
+{"label":"600","value":"600"},
+{"label":"800","value":"800"},
+{"label":"1000","value":"1000"}
+]}
+]}
+]
+}

Modified: hadoop/chukwa/trunk/src/web/hicc/js/workspace/workspace.js
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/js/workspace/workspace.js?rev=763385&r1=763384&r2=763385&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/js/workspace/workspace.js (original)
+++ hadoop/chukwa/trunk/src/web/hicc/js/workspace/workspace.js Wed Apr  8 20:47:03 2009
@@ -870,7 +870,7 @@
 	    module=this.block_obj.module;
 	}
 	var string=module+"/";
-	string+='&page='+this.pageid+'&boxIndex='+this.boxIndex+'&boxId='+this.pageid+'_'+this.boxIndex;
+	string+='&_page='+this.pageid+'&boxIndex='+this.boxIndex+'&boxId='+this.pageid+'_'+this.boxIndex;
 
 	for (iCount=0;iCount<this.block_obj.parameters.length;iCount++) {
 	    string+="&";

Added: hadoop/chukwa/trunk/src/web/hicc/jsp/job_viewer.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/job_viewer.jsp?rev=763385&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/job_viewer.jsp (added)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/job_viewer.jsp Wed Apr  8 20:47:03 2009
@@ -0,0 +1,220 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file 
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*,
org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro,
org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig"
 %> 
+<%
+    XssFilter xf = new XssFilter(request);
+    NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
+    response.setHeader("boxId", xf.getParameter("boxId"));
+    response.setContentType("text/html; chartset=UTF-8//IGNORE"); %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
+<link href="/hicc/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/hicc/js/jquery-1.2.6.min.js"></script>
+<script type="text/javascript" src="/hicc/js/flexigrid.js"></script>
+</head>
+<body>
+<div class="flexigrid">
+<%
+    String boxId=xf.getParameter("boxId");
+    String cluster = (String) session.getAttribute("cluster");
+    DatabaseWriter dbw = new DatabaseWriter(cluster);
+    String path = "";
+    Calendar now = Calendar.getInstance();
+    HashMap<String, Integer> index = new HashMap<String, Integer>();
+    long start = 0;
+    long end = now.getTimeInMillis();
+    String startS="";
+    String endS="";
+    TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
+    startS = time.getStartTimeText();
+    endS = time.getEndTimeText();
+    start = time.getStartTime();
+    end = time.getEndTime();
+    Macro mp = new Macro(start,end,"[util]", request);
+    int averageBy=600;
+    String tmpTable = mp.toString();
+    DatabaseConfig dbc = new DatabaseConfig();
+    String[] tableList = dbc.findTableNameForCharts("util", start, end);
+    if(tableList[0].endsWith("_week")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_month")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_quarter")) {
+      averageBy=1800;
+    } else if(tableList[0].endsWith("_year")) {
+      averageBy=10800;
+    } else if(tableList[0].endsWith("_decade")) {
+      averageBy=43200;
+    }
+    StringBuilder queryBuilder = new StringBuilder();
+    String query = "";
+    queryBuilder.append("select * from [mr_job] where finish_time between '[start]' and '[end]'
");
+    if(xf.getParameter("job_id")!=null) {
+      queryBuilder.append("and job_id='");
+      queryBuilder.append(xf.getParameter("job_id"));
+      queryBuilder.append("'");
+      mp = new Macro(start,end,queryBuilder.toString(), request);
+      query = mp.toString();
+      ResultSet rs = dbw.query(query);
+      ResultSetMetaData rmeta = rs.getMetaData();
+      int col = rmeta.getColumnCount();
+      JSONObject data = new JSONObject();
+      JSONArray rows = new JSONArray();
+      int total=0;
+      while(rs.next()) {
+        JSONArray cells = new JSONArray();
+        out.println("<table id=\"job_summary\">");
+        out.println("<tr><td>Job ID</td><td>User</td><td>Queue</td><td>Status</td><td>Submit
Time</td><td>Launch Time</td><td>Finish Time</td></tr>");
+        out.println("<tr>");
+        for(int i=1;i<=7;i++) {
+          out.println("<td>");
+          out.println(rs.getString(i));
+          out.println("</td>");
+        }
+        out.println("</tr></table>");
+        out.println("<table id=\"job_counters\">");
+        out.println("<tr><td colspan=2>HDFS</td><td colspan=2>Map
Phase</td><td colspan=2>Combine Phase</td><td colspan=2>Reduce Phase</td></tr>");
+        out.println("<tr><td>Bytes Read</td><td>");
+        if(rs.getString(8)!=null) {
+          out.println(rs.getString(8));
+        }
+        out.println("</td>");
+        out.println("<td>Launched Map Tasks</td><td>");
+        if(rs.getString(12)!=null) {
+          out.println(rs.getString(12));
+        }
+        out.println("</td>");
+        out.println("<td>Combine Input Records</td><td>");
+        if(rs.getString(18)!=null) {
+          out.println(rs.getString(18));
+        }
+        out.println("</td>");
+        out.println("<td>Launched Reduce Tasks</td><td>");
+        if(rs.getString(13)!=null) {
+          out.println(rs.getString(13));
+        }
+        out.println("</td>");
+        out.println("</tr>");
+        out.println("<tr><td>Bytes Written</td><td>");
+        if(rs.getString(9)!=null) {
+          out.println(rs.getString(9));
+        }
+        out.println("</td>");
+        out.println("<td>Data Local Map Tasks</td><td>");
+        if(rs.getString(13)!=null) {
+          out.println(rs.getString(13));
+        }
+        out.println("</td>");
+        out.println("<td>Combine Output Records</td><td>");
+        if(rs.getString(19)!=null) {
+          out.println(rs.getString(19));
+        }
+        out.println("</td>");
+        out.println("<td>Data Local Reduce Tasks</td><td>");
+        if(rs.getString(14)!=null) {
+          out.println(rs.getString(14));
+        }
+        out.println("</td></tr>");
+        out.println("<tr><td colspan=2>Local</td>");
+        out.println("<td>Map Input Bytes</td><td>");
+        if(rs.getString(14)!=null) {
+          out.println(rs.getString(14));
+        }
+        out.println("<td>Spilled Records</td><td>");
+        if(rs.getString(20)!=null) {
+          out.println(rs.getString(20));
+        }
+        out.println("</td>");
+        out.println("<td>Reduce Input Group</td><td>");
+        if(rs.getString(21)!=null) {
+          out.println(rs.getString(21));
+        }
+        out.println("</td></tr>");
+        out.println("<tr><td>Bytes Read</td><td>");
+        if(rs.getString(10)!=null) {
+          out.println(rs.getString(10));
+        }
+        out.println("</td>");
+        out.println("<td>Map Output Bytes</td><td>");
+        if(rs.getString(15)!=null) {
+          out.println(rs.getString(15));
+        }
+        out.println("</td>");
+        out.println("<td colspan=2></td>");
+        out.println("<td>Reduce Output Groups</td><td>");
+        if(rs.getString(23)!=null) {
+          out.println(rs.getString(23));
+        }
+        out.println("</td></tr>");
+        out.println("<tr><td>Bytes Written</td><td>");
+        if(rs.getString(11)!=null) {
+          out.println(rs.getString(11));
+        }
+        out.println("</td><td>Map Input Records</td><td>");
+        if(rs.getString(16)!=null) {
+          out.println(rs.getString(16));
+        }
+        out.println("</td><td colspan=2></td>");
+        out.println("<td>Reduce Input Records</td><td>");
+        if(rs.getString(24)!=null) {
+          out.println(rs.getString(24));
+        }
+        out.println("</td></tr>");
+        out.println("<tr><td colspan=2></td>");
+        out.println("<td>Map Output Records</td><td>");
+        if(rs.getString(17)!=null) {
+          out.println(rs.getString(17));
+        }
+        out.println("</td><td colspan=2></td>");
+        out.println("<td>Reduce Output Records</td><td>");
+        if(rs.getString(25)!=null) {
+          out.println(rs.getString(25));
+        }
+        out.println("</td></tr>");
+
+        out.println("</table>");
+        JSONObject job = new JSONObject(rs.getString(col));
+        Iterator<String> keys = job.keys();
+        out.println("<table id=\"job_conf\">");
+        while(keys.hasNext()) {
+          String key = (String) keys.next();
+          out.println("<tr><td>");
+          out.println(key);
+          out.println("</td><td>");
+          out.println(job.get(key));
+          out.println("</td></tr>");
+        }
+        out.println("</table>");
+      }
+      dbw.close();
+    } else {
+      out.println("Please select a Job ID.");
+    }
+%>
+<script type="text/javascript">
+$(document).ready(function(){
+  $('#job_summary').flexigrid({title:'Job Summary',height:'auto'});
+  $('#job_counters').flexigrid({title:'Job Counters',height:'auto'});
+  $('#job_conf').flexigrid({title:'Job Configuration'});
+});
+</script>
+</div></body></html>

Added: hadoop/chukwa/trunk/src/web/hicc/jsp/jobs_viewer.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/jobs_viewer.jsp?rev=763385&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/jobs_viewer.jsp (added)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/jobs_viewer.jsp Wed Apr  8 20:47:03 2009
@@ -0,0 +1,130 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file 
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*,
org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro,
org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig"
 %> 
+<%
+    XssFilter xf = new XssFilter(request);
+    NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
+    response.setHeader("boxId", xf.getParameter("boxId"));
+    response.setContentType("text/html; chartset=UTF-8//IGNORE");
+    String boxId=xf.getParameter("boxId");
+    String cluster = (String) session.getAttribute("cluster");
+    DatabaseWriter dbw = new DatabaseWriter(cluster);
+    String path = "";
+    Calendar now = Calendar.getInstance();
+    HashMap<String, Integer> index = new HashMap<String, Integer>();
+    long start = 0;
+    long end = now.getTimeInMillis();
+    String startS="";
+    String endS="";
+    String[] columns = xf.getParameterValues("column");
+    TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
+    startS = time.getStartTimeText();
+    endS = time.getEndTimeText();
+    start = time.getStartTime();
+    end = time.getEndTime();
+    Macro mp = new Macro(start,end,"[util]", request);
+    int averageBy=600;
+    String tmpTable = mp.toString();
+    DatabaseConfig dbc = new DatabaseConfig();
+    String[] tableList = dbc.findTableNameForCharts("util", start, end);
+    if(tableList[0].endsWith("_week")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_month")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_quarter")) {
+      averageBy=1800;
+    } else if(tableList[0].endsWith("_year")) {
+      averageBy=10800;
+    } else if(tableList[0].endsWith("_decade")) {
+      averageBy=43200;
+    }
+    String query = "select count(*) from [mr_job] where finish_time between '[start]' and
'[end]';";
+    mp = new Macro(start,end,query, request);
+    query = mp.toString();
+    ResultSet rs = dbw.query(query);
+    int total = 0;
+    if(rs.next()) {
+      total = rs.getInt(1);
+    }
+    StringBuilder queryBuilder = new StringBuilder();
+    queryBuilder.append("select job_id,submit_time,launch_time,finish_time,status from [mr_job]
 where finish_time between '[start]' and '[end]' ");
+    if(xf.getParameter("user")!=null) {
+      queryBuilder.append("and user='");
+      queryBuilder.append(xf.getParameter("user"));
+      queryBuilder.append("'");
+    }
+    int pageNum = 0;
+    if(xf.getParameter("page")!=null) {
+      pageNum = Integer.parseInt(xf.getParameter("page"));
+      int rp = Integer.parseInt(xf.getParameter("rp"));
+      queryBuilder.append(" limit ");
+      queryBuilder.append((pageNum-1)*rp);
+      queryBuilder.append(",");
+      queryBuilder.append(rp);
+    }
+    mp = new Macro(start,end,queryBuilder.toString(), request);
+    query = mp.toString();
+    rs = dbw.query(query);
+    ResultSetMetaData rmeta = rs.getMetaData();
+    int col = rmeta.getColumnCount();
+    JSONObject data = new JSONObject();
+    JSONArray rows = new JSONArray();
+    while(rs.next()) {
+      JSONArray cells = new JSONArray();
+      for(int i=1;i<=col;i++) {
+        if(i==1) {
+          StringBuilder sb = new StringBuilder();
+          sb.append("<a href='/hicc/jsp/job_viewer.jsp?job_id=");
+          sb.append(rs.getString(i));
+          sb.append("&height=");
+          sb.append(xf.getParameter("height"));
+          sb.append("'>");
+          sb.append(rs.getString(i));
+          sb.append("</a>");
+          cells.put(sb.toString());
+        } else {
+          if(rmeta.getColumnType(i)==java.sql.Types.BIGINT ||
+            rmeta.getColumnType(i)==java.sql.Types.TINYINT ||
+            rmeta.getColumnType(i)==java.sql.Types.INTEGER) {
+            cells.put(nf.format(rs.getInt(i)));
+          } else if(rmeta.getColumnType(i)==java.sql.Types.FLOAT ||
+            rmeta.getColumnType(i)==java.sql.Types.DOUBLE ||
+            rmeta.getColumnType(i)==java.sql.Types.DECIMAL ) {
+            cells.put(nf.format(rs.getDouble(i)));
+          } else {
+            cells.put(rs.getString(i));
+          }
+        }
+      }
+      JSONObject row = new JSONObject();
+      if(rs.getString(1)!=null) {
+        row.put("id",rs.getString(1));
+      } else {
+        row.put("id","null");
+      }
+      row.put("cell",cells);
+      rows.put(row);
+    }
+    data.put("page",pageNum);
+    data.put("rows",rows);
+    data.put("total",total);
+    dbw.close();
+    out.println(data.toString());
+%>

Added: hadoop/chukwa/trunk/src/web/hicc/jsp/table_viewer.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/table_viewer.jsp?rev=763385&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/table_viewer.jsp (added)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/table_viewer.jsp Wed Apr  8 20:47:03 2009
@@ -0,0 +1,85 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file 
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+<%
+   XssFilter xf = new XssFilter(request);
+   response.setHeader("boxId", xf.getParameter("boxId"));
+   response.setContentType("text/html; chartset=UTF-8//IGNORE");
+%>
+<%@ page import = "java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*,
java.sql.*,java.io.*, java.util.Calendar, java.util.Date, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.extraction.engine.*, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.XssFilter"
%>
+<% String filter=(String)session.getAttribute("filter");
+   if(filter==null) {
+     filter="";
+   } 
+   int height = Integer.parseInt(xf.getParameter("height")) - 65;
+   String url = request.getQueryString();
+   StringBuffer tmp = new StringBuffer();
+   tmp.append(xf.getParameter("report"));
+   tmp.append("?");
+   tmp.append(url);
+   url = tmp.toString();
+   String[] columns = xf.getParameterValues("column");
+   String[] columnsSize = xf.getParameterValues("columnSize");
+   String[] columnsAlign = xf.getParameterValues("columnAlign");
+   if(columnsSize==null) {
+     columnsSize = new String[columns.length];
+     for(int i=0;i<columns.length;i++) {
+       columnsSize[i]=""+columns[i].length()*12;
+     }
+   }
+   if(columnsAlign==null) {
+     columnsAlign = new String[columns.length];
+     for(int i=0;i<columns.length;i++) {
+       columnsAlign[i]="center";
+     }
+   }
+%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
+<link href="/hicc/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/hicc/js/jquery-1.2.6.min.js"></script>
+<script type="text/javascript" src="/hicc/js/flexigrid.js"></script>
+</head>
+<body>
+<div class="flexigrid"><table id="flex1" style="display:none"></table></div>
+<script type="text/javascript">
+$(document).ready(function(){
+  $('#flex1').flexigrid({
+    url: '<%= url %>',
+    dataType: 'json',
+    colModel : [
+<% for(int i=0;i<columns.length;i++) { %>
+    { display: '<%= columns[i] %>', name: '<%= columns[i] %>', width: '<%=
columnsSize[i] %>', sortable: true, align:'<%= columnsAlign[i] %>'}, 
+<% } %>
+    ],
+    sortorder: "asc",
+    usepager: true,
+    useRp: false,
+    rp: 15,
+    striped:false,
+    showTableToggleBtn: true,
+    width: 'auto',
+    height: <%= height %>
+  });
+});
+</script>
+</body>
+</html>

Added: hadoop/chukwa/trunk/src/web/hicc/jsp/util.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/util.jsp?rev=763385&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/util.jsp (added)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/util.jsp Wed Apr  8 20:47:03 2009
@@ -0,0 +1,172 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file 
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*,
org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro,
org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig"
 %> 
+<%
+    XssFilter xf = new XssFilter(request);
+    NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
+    response.setHeader("boxId", xf.getParameter("boxId"));
+    response.setContentType("text/html; chartset=UTF-8//IGNORE");
+    String boxId=xf.getParameter("boxId");
+    String cluster = (String) session.getAttribute("cluster");
+    DatabaseWriter dbw = new DatabaseWriter(cluster);
+    String path = "";
+    Calendar now = Calendar.getInstance();
+    HashMap<String, Integer> index = new HashMap<String, Integer>();
+    long start = 0;
+    long end = now.getTimeInMillis();
+    String startS="";
+    String endS="";
+    String[] columns = xf.getParameterValues("column");
+    TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
+    startS = time.getStartTimeText();
+    endS = time.getEndTimeText();
+    start = time.getStartTime();
+    end = time.getEndTime();
+    Macro mp = new Macro(start,end,"[util]", request);
+    int averageBy=600;
+    String tmpTable = mp.toString();
+    DatabaseConfig dbc = new DatabaseConfig();
+    String[] tableList = dbc.findTableNameForCharts("util", start, end);
+    if(tableList[0].endsWith("_week")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_month")) {
+      averageBy=600;
+    } else if(tableList[0].endsWith("_quarter")) {
+      averageBy=1800;
+    } else if(tableList[0].endsWith("_year")) {
+      averageBy=10800;
+    } else if(tableList[0].endsWith("_decade")) {
+      averageBy=43200;
+    }
+    StringBuilder queryBuilder = new StringBuilder();
+    int pageNum = 0;
+    int rp = 0;
+    if(xf.getParameter("page")!=null) {
+      pageNum = Integer.parseInt(xf.getParameter("page"));
+      rp = Integer.parseInt(xf.getParameter("rp")); 
+    }
+    int total=0;
+    String query = "";
+    if(xf.getParameter("queue")==null) {
+      query = "select count(*) from [util] where timestamp between '[start]' and '[end]'
group by queue;";
+      mp = new Macro(start,end,query, request);
+      query = mp.toString();
+      ResultSet rs = dbw.query(query);
+      if(rs.next()) {
+        total = rs.getInt(1);
+      }
+      queryBuilder.append("select queue,sum(bytes)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/");
+      queryBuilder.append(averageBy);
+      queryBuilder.append("*2) as hdfs_usage,sum(slot_hours)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/");
+      queryBuilder.append(averageBy);
+      queryBuilder.append("*2) as slot_hour from [util] where timestamp between '[start]'
and '[end]' group by queue");
+      mp = new Macro(start,end,queryBuilder.toString(), request);
+      query = mp.toString();
+      if(tableList.length>1) { 
+        StringBuilder queryAdd = new StringBuilder();
+        queryAdd.append("(select * from (");
+        queryAdd.append(query);
+        queryAdd.append(") as t group by queue)");
+        query = queryAdd.toString();
+      }
+    } else {
+      query = "select count(*) from [util] where timestamp between '[start]' and '[end]'
and queue='"+xf.getParameter("queue")+"' group by user;";
+      mp = new Macro(start,end,query, request);
+      query = mp.toString();
+      ResultSet rs = dbw.query(query);
+      if(rs.next()) {
+        total = rs.getInt(1);
+      }
+      queryBuilder.append("select user,sum(bytes)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/");
+      queryBuilder.append(averageBy);
+      queryBuilder.append("*2) as hdfs_usage,sum(slot_hours)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/");
+      queryBuilder.append(averageBy);
+      queryBuilder.append("*2) as slot_hour from [util] where timestamp between '[start]'
and '[end]' and queue='");
+      queryBuilder.append(xf.getParameter("queue"));
+      queryBuilder.append("' group by user");
+      mp = new Macro(start,end,queryBuilder.toString(), request);
+      query = mp.toString();
+      if(tableList.length>1) {
+        StringBuilder queryAdd = new StringBuilder();
+        queryAdd.append("(select * from (");
+        queryAdd.append(query);
+        queryAdd.append(") as t group by user)");
+        query = queryAdd.toString();
+      }
+    }
+    ResultSet rs = dbw.query(query);
+    ResultSetMetaData rmeta = rs.getMetaData();
+    int col = rmeta.getColumnCount();
+    JSONObject data = new JSONObject();
+    JSONArray rows = new JSONArray();
+    while(rs.next()) {
+      JSONArray cells = new JSONArray();
+      for(int i=1;i<=col;i++) {
+        if(xf.getParameter("queue")==null && i==1) {
+          StringBuilder sb = new StringBuilder();
+          sb.append("<a href='/hicc/jsp/table_viewer.jsp?report=%2Fhicc%2Fjsp%2Futil.jsp&column=User&column=HDFS
Storage Usage (GB Per Hour)&column=Slot Hours&columnSize=400&columnSize=100&columnSize=100&height=");
+          sb.append(xf.getParameter("height"));
+          sb.append("&queue=");
+          sb.append(rs.getString(i));
+          sb.append("'>");
+          sb.append(rs.getString(i));
+          sb.append("</a>");
+          cells.put(sb.toString());
+        } else if(xf.getParameter("queue")!=null && i==1) {
+          StringBuilder sb = new StringBuilder();
+          sb.append("<a href='/hicc/jsp/table_viewer.jsp?report=%2Fhicc%2Fjsp%2Fjobs_viewer.jsp&column=Job
ID&column=Submit Time&column=Launch Time&column=Finish Time&column=Status&columnSize=150&columnSize=110&columnSize=110&columnSize=110&columnSize=110&height=");
+          sb.append(xf.getParameter("height"));
+          sb.append("&user=");
+          sb.append(rs.getString(i));
+          sb.append("'>");
+          sb.append(rs.getString(i));
+          sb.append("</a>");
+          cells.put(sb.toString());
+        } else {
+          if(rmeta.getColumnType(i)==java.sql.Types.BIGINT) {
+            cells.put(nf.format(rs.getBigDecimal(i)));
+          } else if(rmeta.getColumnType(i)==java.sql.Types.TINYINT ||
+            rmeta.getColumnType(i)==java.sql.Types.INTEGER) {
+            cells.put(nf.format(rs.getInt(i)));
+          } else if(rmeta.getColumnType(i)==java.sql.Types.FLOAT ||
+            rmeta.getColumnType(i)==java.sql.Types.DOUBLE ||
+            rmeta.getColumnType(i)==java.sql.Types.DECIMAL ) {
+            cells.put(nf.format(rs.getDouble(i)));
+          } else {
+            cells.put(rs.getString(i));
+          }
+        }
+      }
+      JSONObject row = new JSONObject();
+      if(rs.getString(1)!=null) {
+        row.put("id",rs.getString(1));
+      } else {
+        row.put("id","null");
+      }
+      row.put("cell",cells);
+      rows.put(row);
+      total++;
+    }
+    data.put("page",xf.getParameter("page"));
+    data.put("rows",rows);
+    data.put("total",total);
+    dbw.close();
+    out.println(data.toString());
+%>



Mime
View raw message