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/02/25 14:49:43 UTC
svn commit: r1449702 - in /uima/sandbox/uima-ducc/trunk:
uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/
uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/
uima-ducc-web/src/main/java/org/apache/uima/...
Author: degenaro
Date: Mon Feb 25 13:49:42 2013
New Revision: 1449702
URL: http://svn.apache.org/r1449702
Log:
UIMA-2676 DUCC webserver (WS) Services presentation improvements...add Service (dependencies) count/status column to Jobs page & give "waiting for services" as additional rationale for JD failure, as appropriate
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/IRationale.java
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/Rationale.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/IServicesRegistry.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/ServicesRegistry.java
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/DuccHandlerJsonFormat.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/jobs.jsp
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java Mon Feb 25 13:49:42 2013
@@ -397,7 +397,26 @@ public class StateManager {
case Running:
case Idle:
if(jdStatusReport.isKillJob()) {
- jobTerminate(duccWorkJob, JobCompletionType.CanceledByDriver, jdStatusReport.getJobCompletionRationale(), ProcessDeallocationType.JobFailure);
+ IRationale rationale = jdStatusReport.getJobCompletionRationale();
+ switch(duccWorkJob.getJobState()) {
+ case WaitingForServices:
+ if(rationale == null) {
+ rationale = new Rationale("waiting for services");
+ }
+ else {
+ if(rationale.isSpecified()) {
+ String text = rationale.getText();
+ rationale = new Rationale(text+": "+"waiting for services");
+ }
+ else {
+ rationale = new Rationale("waiting for services");
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ jobTerminate(duccWorkJob, JobCompletionType.CanceledByDriver, rationale, ProcessDeallocationType.JobFailure);
break;
}
switch(duccWorkJob.getJobState()) {
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/IRationale.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/IRationale.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/IRationale.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/IRationale.java Mon Feb 25 13:49:42 2013
@@ -22,4 +22,6 @@ import java.io.Serializable;
public interface IRationale extends Serializable {
public String getText();
+ public boolean isSpecified();
+ public boolean isUnspecified();
}
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/Rationale.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/Rationale.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/Rationale.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/Rationale.java Mon Feb 25 13:49:42 2013
@@ -24,8 +24,10 @@ public class Rationale implements IRatio
private String text = null;
+ private static final String unspecified = "unspecified";
+
public Rationale() {
- setText("unspecified");
+ setText(unspecified);
}
public Rationale(String text) {
@@ -45,5 +47,22 @@ public class Rationale implements IRatio
public String toString() {
return getText();
}
+
+ @Override
+ public boolean isSpecified() {
+ return !isUnspecified();
+ }
+
+ @Override
+ public boolean isUnspecified() {
+ boolean retVal = false;
+ if(text == null) {
+ retVal = true;
+ }
+ else if(text.equalsIgnoreCase(unspecified)) {
+ retVal = true;
+ }
+ return retVal;
+ }
}
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/IServicesRegistry.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/IServicesRegistry.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/IServicesRegistry.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/IServicesRegistry.java Mon Feb 25 13:49:42 2013
@@ -37,6 +37,15 @@ public class IServicesRegistry {
public static final String service_state = IStateServices.service_state;
public static final String user = IStateServices.user;
+ public static final String constant_Available = "Available";
+ public static final String constant_true = "true";
+
+ public static final String constant_NotKnown = "NotKnown";
+ public static final String constant_NotAvailable = "NotAvailable";
+ public static final String constant_NotPinging = "NotPinging";
+ public static final String constant_NotHealthy = "NotHealthy";
+ public static final String constant_OK = "OK";
+
// svc
public static final String description = IStateServices.description;
public static final String process_memory_size = IStateServices.process_memory_size;
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/ServicesRegistry.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/ServicesRegistry.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/ServicesRegistry.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/registry/ServicesRegistry.java Mon Feb 25 13:49:42 2013
@@ -159,6 +159,37 @@ public class ServicesRegistry {
return retVal;
}
+ public String getServiceState(String name) {
+ String retVal = IServicesRegistry.constant_NotKnown;
+ try {
+ ServicesRegistryMapPayload payload = findService(name);
+ Properties properties = payload.meta;
+ String service_state = properties.getProperty(IServicesRegistry.service_state).trim();
+ if(service_state.equalsIgnoreCase(IServicesRegistry.constant_Available)) {
+ String ping_active = properties.getProperty(IServicesRegistry.ping_active).trim();
+ if(ping_active.equalsIgnoreCase(IServicesRegistry.constant_true)) {
+ String service_healthy = properties.getProperty(IServicesRegistry.service_healthy).trim();
+ if(service_healthy.equalsIgnoreCase(IServicesRegistry.constant_true)) {
+ retVal = IServicesRegistry.constant_OK;
+ }
+ else {
+ retVal = IServicesRegistry.constant_NotHealthy;
+ }
+ }
+ else {
+ retVal = IServicesRegistry.constant_NotPinging;
+ }
+ }
+ else {
+ retVal = IServicesRegistry.constant_NotAvailable;
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ return retVal;
+ }
+
/*
public static ServicesRegistry sr = new ServicesRegistry();
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=1449702&r1=1449701&r2=1449702&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 Mon Feb 25 13:49:42 2013
@@ -766,4 +766,49 @@ public abstract class DuccAbstractHandle
}
}
+ public String evaluateServices(IDuccWorkJob job, ServicesRegistry servicesRegistry) {
+ StringBuffer sb = new StringBuffer();
+ String[] serviceDependencies = job.getServiceDependencies();
+ if(serviceDependencies == null) {
+ sb.append("<span class=\"health_neutral\" >");
+ sb.append("0");
+ sb.append("</span>");
+ }
+ else if(serviceDependencies.length == 0) {
+ sb.append("<span class=\"health_neutral\" >");
+ sb.append(serviceDependencies.length);
+ sb.append("</span>");
+ }
+ else if(job.isFinished()) {
+ sb.append("<span class=\"health_neutral\" >");
+ sb.append(serviceDependencies.length);
+ sb.append("</span>");
+ }
+ else {
+ StringBuffer bs = new StringBuffer();
+ for(String serviceName : serviceDependencies) {
+ String status = servicesRegistry.getServiceState(serviceName);
+ if(!status.equalsIgnoreCase(IServicesRegistry.constant_OK)) {
+ if(bs.length() != 0) {
+ bs.append("<br>");
+ }
+ bs.append("<span class=\"health_red\" >");
+ bs.append(serviceName);
+ bs.append("=");
+ bs.append(status);
+ bs.append("</span>");
+ }
+ }
+ if(bs.length() != 0) {
+ sb.append(bs);
+ }
+ else {
+ sb.append("<span class=\"health_green\" >");
+ sb.append(serviceDependencies.length);
+ sb.append("</span>");
+ }
+ }
+ return sb.toString();
+ }
+
}
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java Mon Feb 25 13:49:42 2013
@@ -109,7 +109,7 @@ public class DuccHandlerJsonFormat exten
return dir_home+File.separator+dir_resources+File.separator+getDuccWebServer().getClassDefinitionFile();
}
- private JsonArray buildJobRow(HttpServletRequest request, IDuccWorkJob job, DuccData duccData) {
+ private JsonArray buildJobRow(HttpServletRequest request, IDuccWorkJob job, DuccData duccData, ServicesRegistry servicesRegistry) {
String type="Job";
JsonArray row = new JsonArray();
StringBuffer sb;
@@ -271,6 +271,10 @@ public class DuccHandlerJsonFormat exten
sb.append("</span>");
}
row.add(new JsonPrimitive(sb.toString()));
+ // Services
+ sb = new StringBuffer();
+ sb.append(evaluateServices(job,servicesRegistry));
+ row.add(new JsonPrimitive(sb.toString()));
// Processes
sb = new StringBuffer();
sb.append("<span>");
@@ -369,6 +373,8 @@ public class DuccHandlerJsonFormat exten
JsonObject jsonResponse = new JsonObject();
JsonArray data = new JsonArray();
+ ServicesRegistry servicesRegistry = new ServicesRegistry();
+
int maxRecords = getJobsMax(request);
ArrayList<String> users = getJobsUsers(request);
DuccData duccData = DuccData.getInstance();
@@ -439,7 +445,7 @@ public class DuccHandlerJsonFormat exten
}
}
if(list) {
- JsonArray row = buildJobRow(request, job, duccData);
+ JsonArray row = buildJobRow(request, job, duccData, servicesRegistry);
data.add(row);
}
}
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerLegacy.java Mon Feb 25 13:49:42 2013
@@ -95,7 +95,7 @@ public class DuccHandlerLegacy extends D
return dir_home+File.separator+dir_resources+File.separator+getDuccWebServer().getClassDefinitionFile();
}
- private void buildJobsListEntry(HttpServletRequest request, StringBuffer sb, DuccId duccId, IDuccWorkJob job, DuccData duccData) {
+ private void buildJobsListEntry(HttpServletRequest request, StringBuffer sb, DuccId duccId, IDuccWorkJob job, DuccData duccData, ServicesRegistry servicesRegistry) {
String type="Job";
String id = normalize(duccId);
// Terminate
@@ -254,6 +254,10 @@ public class DuccHandlerLegacy extends D
sb.append(jobCompletionType);
sb.append("</td>");
}
+ // Services
+ sb.append("<td valign=\"bottom\" align=\"right\">");
+ sb.append(evaluateServices(job,servicesRegistry));
+ sb.append("</td>");
// Processes
sb.append("<td valign=\"bottom\" align=\"right\">");
if(duccData.isLive(duccId)) {
@@ -327,6 +331,8 @@ public class DuccHandlerLegacy extends D
duccLogger.trace(methodName, jobid, messages.fetch("enter"));
StringBuffer sb = new StringBuffer();
+ ServicesRegistry servicesRegistry = new ServicesRegistry();
+
int maxRecords = getJobsMax(request);
ArrayList<String> users = getJobsUsers(request);
DuccData duccData = DuccData.getInstance();
@@ -398,7 +404,7 @@ public class DuccHandlerLegacy extends D
}
if(list) {
sb.append(trGet(counter));
- buildJobsListEntry(request, sb, job.getDuccId(), job, duccData);
+ buildJobsListEntry(request, sb, job.getDuccId(), job, duccData, servicesRegistry);
}
}
}
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/jobs.jsp
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/jobs.jsp?rev=1449702&r1=1449701&r2=1449702&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/jobs.jsp (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/webapp/root/jobs.jsp Mon Feb 25 13:49:42 2013
@@ -17,51 +17,12 @@ specific language governing permissions
under the License.
-->
<%@ page language="java" %>
-<%
-String table_style = "scroll";
-String cookieName = "ducc:table_style";
-String cookieValue = null;
-Cookie cookie = null;
-Cookie cookies [] = request.getCookies ();
-if (cookies != null)
-{
- for (int i = 0; i < cookies.length; i++)
- {
- if (cookies [i].getName().equals (cookieName))
- {
- cookie = cookies[i];
- cookieValue = cookie.getValue();
- if(cookieValue != null) {
- table_style = cookieValue;
- }
- break;
- }
- }
-}
-%>
<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/cluetip/jquery.cluetip.js" type="text/javascript"></script>
- <link href="opensources/cluetip/jquery.cluetip.css" rel="stylesheet" type="text/css">
-<%
-if (table_style.equals("scroll")) {
-%>
- <script type="text/javascript" language="javascript" src="opensources/DataTables-1.9.1/media/js/jquery.dataTables.min.js"></script>
- <script type="text/javascript" language="javascript" src="opensources/DataTables-plugins/fnReloadAjax.js"></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>
- <link href="ducc.css" rel="stylesheet" type="text/css">
+ <%@ include file="$imports.jsp" %>
<%
if (table_style.equals("scroll")) {
%>
@@ -91,6 +52,7 @@ if (table_style.equals("scroll")) {
$('td:eq(15)', nRow).css( "text-align", "right" );
$('td:eq(16)', nRow).css( "text-align", "right" );
$('td:eq(17)', nRow).css( "text-align", "right" );
+ $('td:eq(18)', nRow).css( "text-align", "right" );
return nRow;
},
} );
@@ -99,13 +61,6 @@ if (table_style.equals("scroll")) {
<%
}
%>
-<%
-if (table_style.equals("classic")) {
-%>
-<script type="text/javascript" src="opensources/sorttable.js"></script>
-<%
-}
-%>
</head>
<body onload="ducc_init('jobs');" onResize="window.location.href = window.location.href;">
@@ -144,37 +99,6 @@ if (table_style.equals("classic")) {
<%
if (table_style.equals("scroll")) {
%>
-<!--
- <table id="jobs-table" width="100%">
- <caption><b>Jobs List</b><br><i><small>click column heading to sort</small></i></caption>
- <thead>
- <tr class="ducc-header">
- <th class="ducc-col-terminate"></th>
- <th title="The system assigned id for this job" class="sorttable_numeric">Id</th>
- <th title="The time this job was submitted">Start</th>
- <th title="The time this job was finished (or the projected time until finish if presently running)">End</th>
- <th class="ducc-no-filter" id="user_column_heading" title="The user who submitted this job">User</th>
- <th title="The user specified class of this job">Class</th>
- <th title="The current state of this job">State</th>
- <th title="The reason for the final state of this job, normally EndOfJob; or extraordinary runtime status">Reason<br><small>or extraordinary status</small></th>
- <th title="The number of job processes currently running">Proc-<br>esses</th>
- <th title="The number of job processes that failed during initialization">Init<br>Fails</th>
- <th title="The number of job processes that failed during runtime (post-initialization)">Run<br>Fails</th>
- <th title="Each job process size, in GB">Size</th>
-
- <th title="The total number of work items for this job">Total</th>
- <th title="The number of work items that completed successfully">Done</th>
- <th title="The number of work items that failed to complete successfully">Error</th>
- <th title="The number of work items currently dispatched (queued+operating)">Dis-<br>patch</th>
- <th title="The number of work items that were retried, excluding preemptions">Retry</th>
- <th title="Tne number of work items that were preempted">Pre-<br>empt</th>
- <th title="The user specified description of this job">Description</th>
- </tr>
- </thead>
- <tbody id="jobs_list_area">
- </tbody>
- </table>
--->
<table id="jobs-table" width="100%">
<caption><b>Jobs List</b><br><i><small>click column heading to sort</small></i></caption>
<thead>
@@ -187,6 +111,7 @@ if (table_style.equals("scroll")) {
<th title="The user specified class of this job">Class</th>
<th title="The current state of this job">State</th>
<th title="The reason for the final state of this job, normally EndOfJob; or extraordinary runtime status">Reason<br><small>or extraordinary status</small></th>
+ <th title="The current state of service dependencies">Services</th>
<th title="The number of job processes currently running">Proc-<br>esses</th>
<th title="The number of job processes that failed during initialization">Init<br>Fails</th>
<th title="The number of job processes that failed during runtime (post-initialization)">Run<br>Fails</th>
@@ -224,6 +149,7 @@ if (table_style.equals("classic")) {
<th title="The user specified class of this job">Class</th>
<th title="The current state of this job">State</th>
<th title="The reason for the final state of this job, normally EndOfJob; or extraordinary runtime status">Reason<br><small>or extraordinary status</small></th>
+ <th title="The current state of service dependencies">Services</th>
<th title="The number of job processes currently running">Proc-<br>esses</th>
<th title="The number of job processes that failed during initialization">Init<br>Fails</th>
<th title="The number of job processes that failed during runtime (post-initialization)">Run<br>Fails</th>