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

webapps.worker.querydetail.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.math.NumberUtils" %>
<%@ page import="org.apache.tajo.QueryId" %>
<%@ page import="org.apache.tajo.SessionVars" %>
<%@ page import="org.apache.tajo.querymaster.Query" %>
<%@ page import="org.apache.tajo.querymaster.QueryMasterTask" %>
<%@ page import="org.apache.tajo.util.JSPUtil" %>
<%@ page import="org.apache.tajo.util.TajoIdUtils" %>
<%@ page import="org.apache.tajo.util.history.HistoryReader" %>
<%@ page import="org.apache.tajo.util.history.QueryHistory" %>
<%@ page import="org.apache.tajo.util.history.StageHistory" %>
<%@ page import="org.apache.tajo.webapp.StaticHttpServer" %>
<%@ page import="org.apache.tajo.worker.TajoWorker" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>

<%
  QueryId queryId = TajoIdUtils.parseQueryId(request.getParameter("queryId"));
  String startTime = request.getParameter("startTime");

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

  boolean runningQuery = queryMasterTask != null;

  QueryHistory queryHistory = null;

  Query query = null;
  if (queryMasterTask != null) {
    query = queryMasterTask.getQuery();
    if (query != null) {
      queryHistory = query.getQueryHistory();
    }
  } else {
    HistoryReader reader = tajoWorker.getWorkerContext().getHistoryReader();
    queryHistory = reader.getQueryHistory(queryId.toString(), NumberUtils.toLong(startTime, 0));
  }

  if (!runningQuery && queryHistory == null) {
    out.write("");
    return;
  }

  List stageHistories =
      queryHistory != null ? JSPUtil.sortStageHistories(queryHistory.getStageHistories()) : null;

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




  
  
  Query Detail Info


<%@ include file="header.jsp"%>

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


<% if (runningQuery && query == null) { out.write("Query Status: " + queryMasterTask.getState()); String errorMessage = queryMasterTask.getErrorMessage(); if (errorMessage != null && !errorMessage.isEmpty()) { out.write("

Message:

" + errorMessage + "
"); } } else if (stageHistories == null) { out.write("

Message:

No Stages
"); } else { %>

<%=queryId.toString()%> [Query Plan]

<% for(StageHistory eachStage: stageHistories) { eachStage.getSucceededObjectCount(); String detailLink = "querytasks.jsp?queryId=" + queryId + "&ebid=" + eachStage.getExecutionBlockId(); %> <% } //end of for %>
IDStateStartedFinishedRunning timeProgressTasks
<%=eachStage.getExecutionBlockId()%> <%=eachStage.getState()%> <%=df.format(eachStage.getStartTime())%> <%=eachStage.getFinishTime() == 0 ? "-" : df.format(eachStage.getFinishTime())%> <%=JSPUtil.getElapsedTime(eachStage.getStartTime(), eachStage.getFinishTime())%> <%=JSPUtil.percentFormat(eachStage.getProgress())%>% <%=eachStage.getSucceededObjectCount()%>/<%=eachStage.getTotalScheduledObjectsCount()%>

Applied Session Variables

<%for(Map.Entry entry: query.getPlan().getContext().getAllKeyValus().entrySet()) { if (SessionVars.exists(entry.getKey()) && SessionVars.isPublic(SessionVars.get(entry.getKey()))) { %> <% } } %>
<%=entry.getKey()%><%=entry.getValue()%>

Logical Plan

<%=query.getPlan().getLogicalPlan().toString()%>

Distributed Query Plan

<%=query.getPlan().toString()%>

<% } //end of else [if (query == null)] %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy