All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapps.worker.taskdetail.jsp Maven / Gradle / Ivy

There is a newer version: 0.11.3
Show newest version
<%
    /*
    * 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.commons.lang.StringUtils" %>
<%@ page import="org.apache.tajo.TaskAttemptId" %>
<%@ page import="org.apache.tajo.ipc.TajoWorkerProtocol" %>
<%@ page import="org.apache.tajo.util.JSPUtil" %>
<%@ page import="org.apache.tajo.util.TajoIdUtils" %>
<%@ page import="org.apache.tajo.webapp.StaticHttpServer" %>
<%@ page import="org.apache.tajo.worker.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>

<%
    TajoWorker tajoWorker = (TajoWorker) StaticHttpServer.getInstance().getAttribute("tajo.info.server.object");

    String containerId = request.getParameter("containerId");
    String quAttemptId = request.getParameter("taskAttemptId");
    TaskAttemptId taskAttemptId = TajoIdUtils.parseTaskAttemptId(quAttemptId);
    Task task = null;
    TaskHistory taskHistory = null;
    if(containerId == null || containerId.isEmpty() || "null".equals(containerId)) {
        task = tajoWorker.getWorkerContext().getTaskRunnerManager().getTaskByTaskAttemptId(taskAttemptId);
        if (task != null) {
            taskHistory = task.createTaskHistory();
        } else {
            taskHistory = tajoWorker.getWorkerContext().getTaskRunnerManager().getTaskHistoryByTaskAttemptId(taskAttemptId);
        }
    } else {
        TaskRunner runner = tajoWorker.getWorkerContext().getTaskRunnerManager().getTaskRunner(containerId);
        if(runner != null) {
            task = runner.getContext().getTask(taskAttemptId);
            if (task != null) {
                taskHistory = task.createTaskHistory();
            } else {
                TaskRunnerHistory history = tajoWorker.getWorkerContext().getTaskRunnerManager().getExcutionBlockHistoryByTaskRunnerId(containerId);
                if(history != null) {
                    taskHistory = history.getTaskHistory(taskAttemptId);
                }
            }
        }
    }
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
%>



    
    
    tajo worker
    <%
        if (taskHistory == null) {
    %>
    
    
<% return; } %> <%@ include file="header.jsp"%>

Tajo Worker: <%=tajoWorker.getWorkerContext().getWorkerName()%>


Task Detail: <%=quAttemptId%>

ID<%=quAttemptId%>
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) { %> <% for (TajoWorkerProtocol.FetcherHistoryProto eachFetcher : fetcherHistories) { %> <% index++; if (pageSize < index) { %> <% break; } } %>
No StartTime FinishTime RunTime Status File Length # Messages
<%=index%> <%=df.format(eachFetcher.getStartTime())%> <%=eachFetcher.getFinishTime() == 0 ? "-" : df.format(eachFetcher.getFinishTime())%> <%=JSPUtil.getElapsedTime(eachFetcher.getStartTime(), eachFetcher.getFinishTime())%> <%=eachFetcher.getState()%> <%=eachFetcher.getFileLength()%> <%=eachFetcher.getMessageReceivedCount()%>
has more ...
<% } else if (task != null) { %> <% for (Fetcher eachFetcher : task.getFetchers()) { %> <% index++; if (pageSize < index) { %> <% break; } } %>
No StartTime FinishTime RunTime Status File Length # Messages URI
<%=index%> <%=df.format(eachFetcher.getStartTime())%> <%=eachFetcher.getFinishTime() == 0 ? "-" : df.format(eachFetcher.getFinishTime())%> <%=JSPUtil.getElapsedTime(eachFetcher.getStartTime(), eachFetcher.getFinishTime())%> <%=eachFetcher.getState()%> <%=eachFetcher.getFileLen()%> <%=eachFetcher.getMessageReceiveCount()%> <%=StringUtils.abbreviate(eachFetcher.getURI().toString(), 50)%>
has more ...
<% } } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy