Author: degenaro Date: Thu Mar 14 17:13:39 2013 New Revision: 1456545 URL: http://svn.apache.org/r1456545 Log: UIMA-2734 DUCC webserver (WS) should give cluster utilization summary in page headings
Modified: 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/$banner/c2-status-job-details.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-jobs.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservation-details.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservations.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-service-details.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-services.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-administration.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-classes.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-daemons.jsp uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-machines.jsp 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/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=1456545&r1=1456544&r2=1456545&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 Mar 14 17:13:39 2013 @@ -85,6 +85,7 @@ import org.apache.uima.ducc.ws.DuccDaemo import org.apache.uima.ducc.ws.DuccData; import org.apache.uima.ducc.ws.DuccMachinesData; import org.apache.uima.ducc.ws.MachineInfo; +import org.apache.uima.ducc.ws.MachineSummaryInfo; import org.apache.uima.ducc.ws.registry.IServicesRegistry; import org.apache.uima.ducc.ws.registry.ServicesRegistry; import org.apache.uima.ducc.ws.registry.ServicesRegistryMapPayload; @@ -125,6 +126,7 @@ public class DuccHandler extends DuccAbs private String duccSystemJobsControl = duccContext+"/jobs-control-request"; private String duccClusterName = duccContext+"/cluster-name"; + private String duccClusterUtilization = duccContext+"/cluster-utilization"; private String duccTimeStamp = duccContext+"/timestamp"; private String duccJobSubmit = duccContext+"/job-submit-request"; private String duccJobCancel = duccContext+"/job-cancel-request"; @@ -2273,6 +2275,28 @@ public class DuccHandler extends DuccAbs duccLogger.trace(methodName, null, messages.fetch("exit")); } + private void handleDuccServletClusterUtilization(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) + throws IOException, ServletException + { + String methodName = "handleDuccServletClusterUtilization"; + duccLogger.trace(methodName, null, messages.fetch("enter")); + StringBuffer sb = new StringBuffer(); + + MachineSummaryInfo msi = DuccMachinesData.getInstance().getTotals(); + + DecimalFormat percentageFormatter = new DecimalFormat("##0.0"); + + String utilization = "0%"; + if(msi.sharesTotal > 0) { + double percentage = (((1.0) * msi.sharesInuse) / ((1.0) * msi.sharesTotal)) * 100.0; + utilization = percentageFormatter.format(percentage)+"%"; + } + + sb.append(utilization); + response.getWriter().println(sb); + duccLogger.trace(methodName, null, messages.fetch("exit")); + } + private void handleDuccServletTimeStamp(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { @@ -3091,6 +3115,10 @@ public class DuccHandler extends DuccAbs handleDuccServletClusterName(target, baseRequest, request, response); //DuccWebUtil.noCache(response); } + else if(reqURI.startsWith(duccClusterUtilization)) { + handleDuccServletClusterUtilization(target, baseRequest, request, response); + DuccWebUtil.noCache(response); + } else if(reqURI.startsWith(duccTimeStamp)) { handleDuccServletTimeStamp(target, baseRequest, request, response); DuccWebUtil.noCache(response); Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-job-details.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-job-details.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-job-details.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-job-details.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-jobs.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-jobs.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-jobs.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-jobs.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservation-details.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-reservation-details.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservation-details.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservation-details.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservations.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-reservations.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservations.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-reservations.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-service-details.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-service-details.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-service-details.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-service-details.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-services.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-services.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-services.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-services.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-administration.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-system-administration.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-administration.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-administration.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-classes.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-system-classes.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-classes.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-classes.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-daemons.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-system-daemons.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-daemons.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-daemons.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-machines.jsp URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/%24banner/c2-status-system-machines.jsp?rev=1456545&r1=1456544&r2=1456545&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-machines.jsp (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/$banner/c2-status-system-machines.jsp Thu Mar 14 17:13:39 2013 @@ -25,6 +25,10 @@ under the License. <td valign="top"><span class="timestamptitle" id="timestamp_area"></span> </tr> <tr> +<td valign="top" align="right" title="The percentage of shares inuse">Utilization:  +<td valign="top"><span class="utilizationtitle" id="utilization_area">?</span> +</tr> +<tr> <td valign="top" align="right">Authentication:  <td valign="top"><span class="authenticationtitle" id="authentication_area">?</span> </tr> 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=1456545&r1=1456544&r2=1456545&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 Mar 14 17:13:39 2013 @@ -181,6 +181,23 @@ function ducc_authentication() } } +function ducc_utilization() +{ + try { + $.ajax( + { + url : "/ducc-servlet/cluster-utilization", + success : function (data) + { + $("#utilization_area").html(data); + } + }); + } + catch(err) { + ducc_error("ducc_utilization",err); + } +} + function ducc_init_common() { try { @@ -202,6 +219,7 @@ function ducc_load_common() ducc_authenticator_version() ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } catch(err) { ducc_error("ducc_load_common",err); @@ -230,6 +248,7 @@ function ducc_load_classic_jobs_data() $("#jobs_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -254,6 +273,7 @@ function ducc_load_scroll_jobs_callback( try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) { @@ -298,6 +318,7 @@ function ducc_load_classic_services_data $("#services_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -322,6 +343,7 @@ function ducc_load_scroll_services_callb try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) { @@ -584,6 +606,7 @@ function ducc_load_service_deployments_d hide_show(); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } }); } @@ -657,6 +680,7 @@ function ducc_load_job_processes_data() hide_show(); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } }); } @@ -694,6 +718,7 @@ function ducc_load_reservation_processes hide_show(); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } }); } @@ -739,6 +764,7 @@ function ducc_load_classic_machines_data $("#machines_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -763,6 +789,7 @@ function ducc_load_scroll_machines_callb try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) { @@ -824,6 +851,7 @@ function ducc_load_classic_reservations_ $("#reservations_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -848,6 +876,7 @@ function ducc_load_scroll_reservations_c try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) { @@ -965,6 +994,7 @@ function ducc_load_submit_reservation_da ducc_load_reservation_submit_button(); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } catch(err) { ducc_error("ducc_load_submit_reservation_data",err); @@ -1029,6 +1059,7 @@ function ducc_load_system_administration $("#system_administration_administrators_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } }); $.ajax( @@ -1039,6 +1070,7 @@ function ducc_load_system_administration $("#system_administration_control_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); } }); } @@ -1086,6 +1118,7 @@ function ducc_load_classic_system_classe $("#system_classes_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -1110,6 +1143,7 @@ function ducc_load_scroll_system_classes try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) { @@ -1225,6 +1259,7 @@ function ducc_load_classic_system_daemon $("#system_daemons_list_area").html(data); ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } }); @@ -1249,6 +1284,7 @@ function ducc_load_scroll_system_daemons try { ducc_timestamp(); ducc_authentication(); + ducc_utilization(); ducc_cluetips(); } catch(err) {