webapps.worker.taskhistory.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.ipc.TajoWorkerProtocol" %>
<%@ page import="org.apache.tajo.util.JSPUtil" %>
<%@ page import="org.apache.tajo.webapp.StaticHttpServer" %>
<%@ page import="org.apache.tajo.worker.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.tajo.util.history.HistoryReader" %>
<%
TajoWorker tajoWorker = (TajoWorker) StaticHttpServer.getInstance().getAttribute("tajo.info.server.object");
HistoryReader reader = new HistoryReader(tajoWorker.getWorkerContext().getWorkerName(), tajoWorker.getWorkerContext().getConf());
TaskHistory taskHistory = reader.getTaskHistory(request.getParameter("taskAttemptId"),
Long.parseLong(request.getParameter("startTime")));
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String referer = request.getHeader("referer");
%>
tajo worker
<%@ include file="header.jsp"%>
<%
if (taskHistory == null) {
%>
No Task history
<%
return;
} //end of if [taskHistory == null]
%>
Tajo Worker: <%=tajoWorker.getWorkerContext().getWorkerName()%>
Task Detail: <%=request.getParameter("taskAttemptId")%>
ID <%=request.getParameter("taskAttemptId")%>
State <%=taskHistory.getState()%>
Start Time <%=taskHistory.getStartTime() == 0 ? "-" : df.format(taskHistory.getStartTime())%>
Finish Time <%=taskHistory.getFinishTime() == 0 ? "-" : df.format(taskHistory.getFinishTime())%>
Running Time <%=JSPUtil.getElapsedTime(taskHistory.getStartTime(), taskHistory.getFinishTime())%>
Progress <%=JSPUtil.percentFormat(taskHistory.getProgress())%>%
Output Path <%=taskHistory.getOutputPath()%>
Working Path <%=taskHistory.getWorkingPath()%>
Input Statistics <%=JSPUtil.tableStatToString(taskHistory.getInputStats())%>
Output Statistics <%=JSPUtil.tableStatToString(taskHistory.getOutputStats())%>
<%
if (taskHistory.hasFetcherHistories()) {
%>
Fetch Status
<%= taskHistory.getFinishedFetchCount() + "/" + taskHistory.getTotalFetchCount() %> (Finished/Total)
<%
int index = 1;
int pageSize = 1000; //TODO pagination
List fetcherHistories = taskHistory.getFetcherHistories();
if (fetcherHistories.size() > 0) {
%>
No StartTime FinishTime RunTime Status File Length # Messages
<%
for (TajoWorkerProtocol.FetcherHistoryProto eachFetcher : fetcherHistories) {
%>
<%=index%>
<%=df.format(eachFetcher.getStartTime())%>
<%=eachFetcher.getFinishTime() == 0 ? "-" : df.format(eachFetcher.getFinishTime())%>
<%=JSPUtil.getElapsedTime(eachFetcher.getStartTime(), eachFetcher.getFinishTime())%>
<%=eachFetcher.getState()%>
<%=eachFetcher.getFileLength()%>
<%=eachFetcher.getMessageReceivedCount()%>
<%
index++;
if (pageSize < index) {
%>
has more ...
<%
break;
}
} // end of for loop
} // end of if [fetcherHistories.size() > 0]
}
%>