webapps.admin.task.jsp Maven / Gradle / Ivy
<%
/*
* 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 language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.tajo.util.JSPUtil" %>
<%@ page import="org.apache.tajo.util.TajoIdUtils" %>
<%@ page import="org.apache.tajo.webapp.StaticHttpServer" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="org.apache.tajo.master.TajoMaster" %>
<%@ page import="org.apache.tajo.util.history.HistoryReader" %>
<%@ page import="org.apache.tajo.util.history.TaskHistory" %>
<%@ page import="java.util.List" %>
<%
TajoMaster master = (TajoMaster) StaticHttpServer.getInstance().getAttribute("tajo.info.server.object");
HistoryReader reader = master.getContext().getHistoryReader();
String queryId = request.getParameter("queryId");
String ebId = request.getParameter("ebid");
String status = request.getParameter("status");
if(status == null || status.isEmpty() || "null".equals(status)) {
status = "ALL";
}
String taskAttemptId = request.getParameter("taskAttemptId");
List allTasks = reader.getTaskHistory(queryId, ebId);
TaskHistory task = null;
for(TaskHistory eachTask: allTasks) {
if (eachTask.getId().equals(taskAttemptId)) {
task = eachTask;
break;
}
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String backUrl = request.getHeader("referer");
%>
Query Unit Detail
<%
if (task == null) {
%>
No Task history.
<%
return;
}
String fragmentInfo = "";
String delim = "";
for (String eachFragment : task.getFragments()) {
fragmentInfo += delim + eachFragment;
delim = "
";
}
String fetchInfo = "";
delim = "";
String previousKey = null;
for (String[] e : task.getFetchs()) {
if (previousKey == null || !previousKey.equals(e[0])) {
fetchInfo += delim + "" + e[0] + "";
}
delim = "
";
fetchInfo += delim + e[1];
previousKey = e[0];
}
String dataLocationInfos = "";
delim = "";
for (String eachLocation: task.getDataLocations()) {
dataLocationInfos += delim + eachLocation.toString();
delim = "
";
}
int numShuffles = task.getNumShuffles();
String shuffleKey = "-";
String shuffleFileName = "-";
if(numShuffles > 0) {
shuffleKey = task.getShuffleKey();
shuffleFileName = task.getShuffleFileName();
}
%>
<%@ include file="header.jsp"%>
Tajo Master: <%=master.getMasterName()%> <%=JSPUtil.getMasterActiveLabel(master.getContext())%>
<%=ebId%>
ID <%=task.getId()%>
Progress <%=JSPUtil.percentFormat(task.getProgress())%>%
State <%=task.getState()%>
Launch Time <%=task.getLaunchTime() == 0 ? "-" : df.format(task.getLaunchTime())%>
Finish Time <%=task.getFinishTime() == 0 ? "-" : df.format(task.getFinishTime())%>
Running Time <%=task.getLaunchTime() == 0 ? "-" : task.getRunningTime() + " ms"%>
Host <%=task.getHostAndPort() == null ? "-" : task.getHostAndPort()%>
Shuffles # Shuffle Outputs: <%=numShuffles%>, Shuffle Key: <%=shuffleKey%>, Shuffle file: <%=shuffleFileName%>
Data Locations <%=dataLocationInfos%>
Fragment <%=fragmentInfo%>
Fetches <%=fetchInfo%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy