<% /* * 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, java.util.ArrayList, org.apache.hadoop.hbase.HBaseConfiguration, org.apache.hadoop.hbase.client.HTableInterface, org.apache.hadoop.hbase.client.HTablePool, org.apache.hadoop.hbase.client.Result, org.apache.hadoop.hbase.client.ResultScanner, org.apache.hadoop.hbase.client.Scan, org.apache.hadoop.conf.Configuration" %> <%! final static private Configuration hconf = HBaseConfiguration.create(); %> <%! final static private HTablePool pool = new HTablePool(hconf, 60); %> <% XssFilter xf = new XssFilter(request); NumberFormat nf = new DecimalFormat("###,###,###,##0.00"); SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss"); 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"); TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); long start = time.getStartTime(); long end = time.getEndTime(); HTableInterface table = pool.getTable("Jobs"); String family = "summary"; Scan scan = new Scan(); scan.addColumn(family.getBytes(), "jobId".getBytes()); scan.addColumn(family.getBytes(), "user".getBytes()); scan.addColumn(family.getBytes(), "submitTime".getBytes()); scan.addColumn(family.getBytes(), "launchTime".getBytes()); scan.addColumn(family.getBytes(), "finishTime".getBytes()); scan.addColumn(family.getBytes(), "status".getBytes()); scan.addColumn(family.getBytes(), "cluster".getBytes()); scan.addColumn(family.getBytes(), "queue".getBytes()); scan.addColumn(family.getBytes(), "numMaps".getBytes()); scan.addColumn(family.getBytes(), "numReduces".getBytes()); scan.addColumn(family.getBytes(), "numSlotsPerMap".getBytes()); scan.addColumn(family.getBytes(), "numSlotsPerReduce".getBytes()); scan.addColumn(family.getBytes(), "mapSlotSeconds".getBytes()); scan.addColumn(family.getBytes(), "reduceSlotsSeconds".getBytes()); scan.addColumn(family.getBytes(), "status".getBytes()); scan.setTimeRange(start, end); scan.setMaxVersions(); ResultScanner results = table.getScanner(scan); Iterator it = results.iterator(); %> <% while(it.hasNext()) { Result result = it.next(); boolean print = true; if(xf.getParameter("job_id")!=null) { print = false; } String jobId = new String(result.getValue(family.getBytes(), "jobId".getBytes())); if(jobId.equals(xf.getParameter("job_id"))) { print = true; } if(cluster!=null && cluster.equals(new String(result.getValue(family.getBytes(), "cluster".getBytes())))) { print = true; } if(print) { %> <% } } results.close(); table.close(); %>
Job ID Cluster User Queue Status Submit Time Launch Time Finish Time Number of Maps Number of Reduces Number of Slots Per Map Number of Slots Per Reduce Map Slots Seconds Reduce Slots Seconds
<%= new String(result.getValue(family.getBytes(), "jobId".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "cluster".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "user".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "queue".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "status".getBytes())) %> <%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "submitTime".getBytes())))) %> <%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "launchTime".getBytes())))) %> <%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "finishTime".getBytes())))) %> <%= new String(result.getValue(family.getBytes(), "numMaps".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "numReduces".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "numSlotsPerMap".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "numSlotsPerReduce".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "mapSlotSeconds".getBytes())) %> <%= new String(result.getValue(family.getBytes(), "reduceSlotsSeconds".getBytes())) %>