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

webapps.worker.task.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.tajo.ExecutionBlockId" %>
<%@ page import="org.apache.tajo.QueryId" %>
<%@ page import="org.apache.tajo.TaskId" %>
<%@ page import="org.apache.tajo.catalog.proto.CatalogProtos" %>
<%@ page import="org.apache.tajo.catalog.statistics.TableStats" %>
<%@ page import="org.apache.tajo.ipc.TajoWorkerProtocol" %>
<%@ page import="org.apache.tajo.querymaster.Query" %>
<%@ page import="org.apache.tajo.querymaster.QueryMasterTask" %>
<%@ page import="org.apache.tajo.querymaster.Task" %>
<%@ page import="org.apache.tajo.querymaster.Stage" %>
<%@ page import="org.apache.tajo.storage.DataLocation" %>
<%@ page import="org.apache.tajo.storage.fragment.FileFragment" %>
<%@ page import="org.apache.tajo.storage.fragment.FragmentConvertor" %>
<%@ 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.FetchImpl" %>
<%@ page import="org.apache.tajo.worker.TajoWorker" %>
<%@ page import="java.net.URI" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="org.apache.tajo.storage.fragment.Fragment" %>

<%
    String paramQueryId = request.getParameter("queryId");
    String paramEbId = request.getParameter("ebid");
    String status = request.getParameter("status");
    if(status == null || status.isEmpty() || "null".equals(status)) {
        status = "ALL";
    }

    QueryId queryId = TajoIdUtils.parseQueryId(paramQueryId);
    ExecutionBlockId ebid = TajoIdUtils.createExecutionBlockId(paramEbId);

    int taskSeq = Integer.parseInt(request.getParameter("taskSeq"));
    TajoWorker tajoWorker = (TajoWorker) StaticHttpServer.getInstance().getAttribute("tajo.info.server.object");
    QueryMasterTask queryMasterTask = tajoWorker.getWorkerContext()
            .getQueryMasterManagerService().getQueryMaster().getQueryMasterTask(queryId, true);

    if(queryMasterTask == null) {
        out.write("");
        return;
    }

    Query query = queryMasterTask.getQuery();
    Stage stage = query.getStage(ebid);

    if(stage == null) {
        out.write("");
        return;
    }

    if(stage == null) {
%>

<%
        return;
    }
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    TaskId taskId = new TaskId(ebid, taskSeq);
    Task task = stage.getTask(taskId);
    if(task == null) {
%>

<%
        return;
    }

    String sort = request.getParameter("sort");
    String sortOrder = request.getParameter("sortOrder");

    String backUrl = "querytasks.jsp?queryId=" + paramQueryId + "&ebid=" + paramEbId + "&sort=" + sort + "&sortOrder=" + sortOrder + "&status=" + status;

    String fragmentInfo = "";
    String delim = "";
    for (CatalogProtos.FragmentProto eachFragment : task.getAllFragments()) {
        Fragment fragment = FragmentConvertor.convert(tajoWorker.getConfig(), eachFragment);
        fragmentInfo += delim + fragment.toString();
        delim = "
"; } String fetchInfo = ""; delim = ""; for (Map.Entry> e : task.getFetchMap().entrySet()) { fetchInfo += delim + "" + e.getKey() + ""; delim = "
"; for (FetchImpl f : e.getValue()) { for (URI uri : f.getSimpleURIs()){ fetchInfo += delim + uri; } } } String dataLocationInfos = ""; delim = ""; for(DataLocation eachLocation: task.getDataLocations()) { dataLocationInfos += delim + eachLocation.toString(); delim = "
"; } int numShuffles = task.getShuffleOutpuNum(); String shuffleKey = "-"; String shuffleFileName = "-"; if(numShuffles > 0) { TajoWorkerProtocol.ShuffleFileOutput shuffleFileOutputs = task.getShuffleFileOutputs().get(0); shuffleKey = "" + shuffleFileOutputs.getPartId(); shuffleFileName = shuffleFileOutputs.getFileName(); } TableStats inputStat = task.getLastAttempt().getInputStats(); TableStats outputStat = task.getLastAttempt().getResultStats(); %> Query Unit Detail <%@ include file="header.jsp"%>

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


<%=ebid.toString()%>


ID<%=task.getId()%>
Progress<%=JSPUtil.percentFormat(task.getLastAttempt().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.getSucceededHost() == null ? "-" : task.getSucceededHost()%>
Shuffles# Shuffle Outputs: <%=numShuffles%>, Shuffle Key: <%=shuffleKey%>, Shuffle file: <%=shuffleFileName%>
Data Locations<%=dataLocationInfos%>
Fragment<%=fragmentInfo%>
Input Statistics<%=JSPUtil.tableStatToString(inputStat)%>
Output Statistics<%=JSPUtil.tableStatToString(outputStat)%>
Fetches<%=fetchInfo%>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy