You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2013/06/06 15:58:52 UTC

svn commit: r1490288 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main: java/org/apache/uima/ducc/ws/server/ webapp/root/ webapp/root/js/

Author: degenaro
Date: Thu Jun  6 13:58:51 2013
New Revision: 1490288

URL: http://svn.apache.org/r1490288
Log:
UIMA-2949 DUCC webserver (WS) javascript performance improvements

Added:
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.html
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.jsp
Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccAbstractHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/js/ducc.js

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccAbstractHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccAbstractHandler.java?rev=1490288&r1=1490287&r2=1490288&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccAbstractHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccAbstractHandler.java Thu Jun  6 13:58:51 2013
@@ -70,10 +70,15 @@ public abstract class DuccAbstractHandle
 	public static DuccWebAdministrators duccWebAdministrators = DuccWebAdministrators.getInstance();
 	public static DuccWebSessionManager duccWebSessionManager = DuccWebSessionManager.getInstance();
 	
+	public final String duccUimaInitializationReport		  = "uima-initialization-report.html";
+	
 	public final String duccContext = "/ducc-servlet";
 	
 	public final String duccLogData			  = duccContext+"/log-data";
 	
+	public final String duccJpInitSummary	  = duccContext+"/uima-initialization-report-summary";
+	public final String duccJpInitData		  = duccContext+"/uima-initialization-report-data";
+	
 	public final String duccContextJsonFormat = duccContext+"/json-format";
 	public final String duccContextUser       = duccContext+"/user";
 	public final String duccContextLegacy     = duccContext+"/legacy";

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java?rev=1490288&r1=1490287&r2=1490288&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java Thu Jun  6 13:58:51 2013
@@ -360,6 +360,9 @@ public class DuccHandler extends DuccAbs
 		return retVal;
 	}
 	
+	String pname_idJob = "idJob";
+	String pname_idPro = "idPro";
+	
 	private void buildJobProcessListEntry(StringBuffer sb, DuccWorkJob job, IDuccProcess process, String type, int counter) {
 		String location = "buildJobProcessListEntry";
 		String logsjobdir = job.getUserLogsDir()+job.getDuccId().getFriendly()+File.separator;
@@ -496,6 +499,9 @@ public class DuccHandler extends DuccAbs
 				}
 				boolean cluetips_disabled = true;
 				if(cluetips_disabled) {
+					String p_idJob = pname_idJob+"="+job.getDuccId().getFriendly();
+					String p_idPro = pname_idPro+"="+process.getDuccId().getFriendly();
+					initTime = "<a href=\""+duccUimaInitializationReport+"?"+p_idJob+"&"+p_idPro+"\" onclick=\"var newWin = window.open(this.href,'child','height=600,width=475,scrollbars');  newWin.focus(); return false;\">"+initTime+"</a>";
 					loadme.append("");
 				}
 				else {
@@ -2671,6 +2677,84 @@ public class DuccHandler extends DuccAbs
 		duccLogger.trace(methodName, null, messages.fetch("exit"));
 	}	
 	
+	private void handleDuccServletJpInitSummary(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) 
+	throws IOException, ServletException
+	{
+		String methodName = "handleDuccServletJpInitSummary";
+		duccLogger.trace(methodName, null, messages.fetch("enter"));
+		String idJob = request.getParameter(pname_idJob);
+		String idPro = request.getParameter(pname_idPro);
+		StringBuffer sb = new StringBuffer();
+		
+		sb.append("<b>");
+		sb.append("Id[job]:");
+		sb.append(" ");
+		sb.append(idJob);
+		sb.append(" ");
+		sb.append("Id[process]:");
+		sb.append(" ");
+		sb.append(idPro);
+		sb.append("</b>");
+		
+		response.getWriter().println(sb);
+		duccLogger.trace(methodName, null, messages.fetch("exit"));
+	}	
+	
+	private void handleDuccServletJpInitData(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) 
+	throws IOException, ServletException
+	{
+		String methodName = "handleDuccServletJpInitData";
+		duccLogger.trace(methodName, null, messages.fetch("enter"));
+		String idJob = request.getParameter(pname_idJob);
+		String idPro = request.getParameter(pname_idPro);
+		StringBuffer sb = new StringBuffer();
+		
+		DuccWorkMap duccWorkMap = DuccData.getInstance().get();
+		DuccWorkJob job = null;
+		if(duccWorkMap.getJobKeySet().size()> 0) {
+			Iterator<DuccId> iterator = null;
+			iterator = duccWorkMap.getJobKeySet().iterator();
+			while(iterator.hasNext()) {
+				DuccId jobId = iterator.next();
+				String fid = ""+jobId.getFriendly();
+				if(idJob.equals(fid)) {
+					job = (DuccWorkJob) duccWorkMap.findDuccWork(jobId);
+					break;
+				}
+			}
+		}
+		if(job != null) {
+			IDuccProcess process = job.getProcess(idPro);
+			if(process != null) {
+				List<IUimaPipelineAEComponent> upcList = process.getUimaPipelineComponents();
+				if(upcList != null) {
+					if(!upcList.isEmpty()) {
+						Iterator<IUimaPipelineAEComponent> upcIterator = upcList.iterator();
+						while(upcIterator.hasNext()) {
+							IUimaPipelineAEComponent upc = upcIterator.next();
+							String iName = upc.getAeName();
+							String iState = upc.getAeState().toString();
+							String iTime = FormatHelper.duration(upc.getInitializationTime());
+							sb.append("<tr>");
+							sb.append("<td>"+iName);
+							sb.append("<td>"+iState);
+							sb.append("<td align=\"right\">"+iTime);
+						}
+					}
+				}
+			}
+		}
+		if(sb.length() == 0) {
+			sb.append("<tr>");
+			sb.append("<td>"+"no data");
+			sb.append("<td>");
+			sb.append("<td>");
+		}
+		
+		response.getWriter().println(sb);
+		duccLogger.trace(methodName, null, messages.fetch("exit"));
+	}	
+	
 	private void handleDuccServletjConsoleLink(
 			String target,
 			Request baseRequest,
@@ -3440,6 +3524,14 @@ public class DuccHandler extends DuccAbs
 				handleDuccServletLogData(target, baseRequest, request, response);
 				DuccWebUtil.noCache(response);
 			}
+			else if(reqURI.startsWith(duccJpInitSummary)) {
+				handleDuccServletJpInitSummary(target, baseRequest, request, response);
+				DuccWebUtil.noCache(response);
+			}
+			else if(reqURI.startsWith(duccJpInitData)) {
+				handleDuccServletJpInitData(target, baseRequest, request, response);
+				DuccWebUtil.noCache(response);
+			}
 			else if(reqURI.startsWith(duccjConsoleLink)) {
 				handleDuccServletjConsoleLink(target, baseRequest, request, response);
 				DuccWebUtil.noCache(response);

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/js/ducc.js
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/js/ducc.js?rev=1490288&r1=1490287&r2=1490288&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/js/ducc.js (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/js/ducc.js Thu Jun  6 13:58:51 2013
@@ -1506,6 +1506,9 @@ function ducc_init(type)
 			ducc_load_job_performance_data();
 			ducc_load_job_specification_data();
 		}
+		if(type == "uima-initialization-report") {
+		    uima_initialization_report();
+		}
 		if(type == "reservation-details") {
 			ducc_init_reservation_processes_data();
 			ducc_init_reservation_specification_data();
@@ -1604,6 +1607,51 @@ function ducc_cookies()
 	}		
 }
 
+function uima_initialization_report_summary()
+{
+    try {
+        $.ajax(
+        {
+            url : "/ducc-servlet/uima-initialization-report-summary"+location.search,
+            success : function (data) 
+            {
+                $("#uima_initialization_report_summary").html(data);
+            }
+        });
+    }
+    catch(err) {
+        ducc_error("uima_initialization_report_summary",err);location
+    }
+}
+
+function uima_initialization_report_data()
+{
+    try {
+        $.ajax(
+        {
+            url : "/ducc-servlet/uima-initialization-report-data"+location.search,
+            success : function (data) 
+            {
+                $("#uima_initialization_report_data").html(data);
+            }
+        });
+    }
+    catch(err) {
+        ducc_error("uima_initialization_report_data",err);
+    }
+}
+
+function uima_initialization_report(name)
+{
+	try {
+		uima_initialization_report_summary();
+		uima_initialization_report_data();
+	}
+	catch(err) {
+		ducc_error("uima_initialization_report",err);
+	}	
+}
+
 function ducc_appl(name)
 {
 	try {

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.html
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.html?rev=1490288&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.html (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.html Thu Jun  6 13:58:51 2013
@@ -0,0 +1,29 @@
+<!--
+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.
+-->
+<html>
+<head>
+<script language="javascript">
+<!--
+location.replace("uima-initialization-report.jsp"+location.search)
+//-->
+</script>
+</head>
+<body>
+</body>
+</html>

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.jsp
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.jsp?rev=1490288&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.jsp (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/uima-initialization-report.jsp Thu Jun  6 13:58:51 2013
@@ -0,0 +1,92 @@
+<!--
+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.
+-->
+<html>
+<head>
+  <link rel="shortcut icon" href="uima.ico" />
+  <title>ducc-mon</title>
+  <meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
+  <script src="opensources/jquery-1.4.2.js" type="text/javascript"></script>
+  <script src="opensources/jgrowl/jquery.jgrowl.js" type="text/javascript"></script>
+  <link rel="stylesheet" href="opensources/jgrowl/jquery.jgrowl.css" type="text/css"/>
+  <link href="opensources/jquery-ui-1.8.4/gallery/jquery-ui-themes-1.8.4/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css"/>
+  <script src="opensources/jquery-ui-1.8.4/ui/minified/jquery-ui.min.js"></script>
+  <link href="opensources/navigation/menu.css" rel="stylesheet" type="text/css">
+  <script src="js/ducc.js"></script>
+  <script type="text/javascript" src="opensources/sorttable.js"></script>
+  <link href="ducc.css" rel="stylesheet" type="text/css">
+</head>
+
+<body onload="ducc_init('uima-initialization-report');">
+<table width="100%">
+
+<tr>
+<td>
+  <div style="display:none">
+    <span>
+      <h2><span class="title">&nbsp </span></h2>
+    </span>
+    <h3>Refresh</h3>
+    <table>
+    <tr>
+    <td>
+      <div id="refreshbutton">
+        <input type="image" onClick="location.reload()" title="Refresh" alt="Refresh" src="opensources/images/1284662827_refresh.png">
+      </div>
+    <td>
+      <div>
+        <form name="duccform">
+        <input type="radio" name="refresh" value="manual"            onClick="ducc_put_cookie('ducc:refreshmode','manual'   )" /> Manual
+        <input type="radio" name="refresh" value="automatic" checked onClick="ducc_put_cookie('ducc:refreshmode','automatic')" /> Automatic
+        </form> 
+      </div>
+    </table>
+  </div>
+  
+<tr>
+<td>  
+  <span id="uima_initialization_report_summary">?</span> 
+</td>
+
+<tr>
+<td>
+  <!--
+  <table class="sortable">
+  -->
+  <table>
+  <caption><b>UIMA Process Initialization Details</b></caption>
+  <thead>
+  <tr class="ducc-head">
+  <th>Name
+  <th>State
+  <th>Time<br><small>ddd:hh:mm:ss</small>
+  </thead>
+  <tbody id="uima_initialization_report_data">
+  </tbody>
+  </table>
+</td>
+
+<tr>
+<td>  
+  <%@ include file="$copyright.jsp" %>	
+</td>
+
+</table>
+<script src="opensources/navigation/menu.js"></script>
+</body>
+</html>