You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ch...@apache.org on 2014/06/19 18:54:14 UTC
svn commit: r1603942 - in /uima/sandbox/uima-ducc/trunk:
uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/
uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/
uima-ducc-transport/src/main/java/org/apache/uima/ducc/transpo...
Author: challngr
Date: Thu Jun 19 16:54:13 2014
New Revision: 1603942
URL: http://svn.apache.org/r1603942
Log:
UIMA-3831 Fix incorrect error reflection if error in init of reference-started service.
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/IStateServices.java
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceInstance.java
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDependency.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/IStateServices.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/IStateServices.java?rev=1603942&r1=1603941&r2=1603942&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/IStateServices.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/IStateServices.java Thu Jun 19 16:54:13 2014
@@ -45,7 +45,7 @@ public interface IStateServices {
public static final String last_use = "last-use";
public static final String service_statistics = "service-statistics";
public static final String service_type = "service-type";
- public static final String submit_error = "submit_error";
+ public static final String submit_error = "submit-error";
public static final String user = "user";
public static final String scheduling_class = "scheduling_class";
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java?rev=1603942&r1=1603941&r2=1603942&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java Thu Jun 19 16:54:13 2014
@@ -40,7 +40,6 @@ import org.apache.uima.ducc.transport.ev
import org.apache.uima.ducc.transport.event.ServiceStopEvent;
import org.apache.uima.ducc.transport.event.ServiceUnregisterEvent;
import org.apache.uima.ducc.transport.event.common.DuccWorkJob;
-import org.apache.uima.ducc.transport.event.common.IDuccProcess;
import org.apache.uima.ducc.transport.event.common.IDuccProcessMap;
import org.apache.uima.ducc.transport.event.common.IDuccWork;
import org.apache.uima.ducc.transport.event.sm.IService.ServiceState;
@@ -256,12 +255,12 @@ public class ServiceHandler
sset = serviceStateHandler.getUnregisteredServiceByUrl(dep);
if ( sset == null ) {
// Still null, never h'oid of de guy
- s.addMessage(dep, "Independent registered service [" + dep + "] is unknown.");
+ s.addMessage(dep, "Service is unknown.");
s.setState(ServiceState.NotAvailable);
} else {
// The service is deregistered but not yet purged, may as well tell him. It can
// take a while for these guys to go away.
- s.addMessage(dep, "Independent registered service [" + dep + "] has been deregistered and is terminating.");
+ s.addMessage(dep, "Service has been deregistered and is terminating.");
s.setState(ServiceState.NotAvailable);
}
fatal = true;
@@ -311,6 +310,9 @@ public class ServiceHandler
for ( ServiceSet sset : services.values() ) {
if ( sset.getState().ordinality() < state.ordinality() ) state = sset.getState();
dep.setIndividualState(sset.getKey(), sset.getState());
+ if ( sset.excessiveFailures() ) {
+ dep.addMessage(sset.getKey(), sset.getErrorString());
+ }
// logger.debug(methodName, id, "Set individual state", sset.getState());
}
dep.setState(state);
@@ -384,6 +386,8 @@ public class ServiceHandler
resolveState(id, s);
logger.info(methodName, id, "Added job to map, with service dependency state.", s.getState());
+
+ logger.info(methodName, id, s.getMessages());
}
serviceMap.putAll(updates);
@@ -893,8 +897,6 @@ public class ServiceHandler
return new ServiceReplyEvent(true, "Modifying", sset.getKey(), sset.getId().getFriendly());
}
- boolean dirty_meta_props = false;
- boolean dirty_job_props = false;
boolean restart_pinger = false;
boolean restart_service = false;
@@ -910,13 +912,11 @@ public class ServiceHandler
case Instances:
intval = Integer.parseInt(value);
sset.updateRegisteredInstances(intval);
- dirty_meta_props = true;
break;
case Autostart:
boolval = Boolean.parseBoolean(value);
sset.setAutostart(boolval);
- dirty_meta_props = true;
break;
// For the moment, these all update the registration but don't change internal
@@ -936,25 +936,21 @@ public class ServiceHandler
case ProcessInitializationTimeMax:
case WorkingDirectory:
sset.setJobProperty(option.pname(), value);
- dirty_job_props = true;
break;
case InstanceInitFailureLimit:
sset.updateInitFailureLimit(value);
sset.setJobProperty(option.pname(), value);
- dirty_job_props = true;
break;
case ServiceLinger:
sset.updateLinger(value);
sset.setJobProperty(option.pname(), value);
- dirty_job_props = true;
break;
case ProcessDebug:
// Note this guy updates the props differently based on the value
sset.updateDebug(value); // value may be numeric, or "off"
- dirty_job_props = true;
break;
case ServicePingArguments:
@@ -967,7 +963,6 @@ public class ServiceHandler
case InstanceFailureLimit:
sset.setJobProperty(option.pname(), value);
restart_pinger = true;
- dirty_job_props = true;
break;
}
@@ -1017,14 +1012,9 @@ public class ServiceHandler
logger.info(methodName, sset.getId(), "Modify", kk, "to", v, "restart_service[" + restart_service + "]", "restart_pinger[" + restart_pinger + "]");
}
- if ( dirty_job_props ) {
- sset.saveServiceProperties();
- dirty_job_props = false;
- }
- if ( dirty_meta_props ) {
- sset.saveMetaProperties();
- dirty_meta_props = false;
- }
+ sset.resetRuntimeErrors();
+ sset.saveServiceProperties();
+ sset.saveMetaProperties();
if ( restart_pinger ) {
sset.restartPinger();
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceInstance.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceInstance.java?rev=1603942&r1=1603941&r2=1603942&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceInstance.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceInstance.java Thu Jun 19 16:54:13 2014
@@ -259,10 +259,10 @@ class ServiceInstance
if ( ! started ) {
logger.warn(methodName, null, "Request to start service " + sset.getId().toString() + " failed.");
- meta_props.put("submit_error", submit_buffer.toString());
+ meta_props.put("submit-error", submit_buffer.toString());
sset.log_errors(stdout_lines, stderr_lines);
} else {
- meta_props.remove("submit_error");
+ meta_props.remove("submit-error");
state = JobState.Received;
}
logger.info(methodName, sset.getId(), "START INSTANCE COMPLETE");
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java?rev=1603942&r1=1603941&r2=1603942&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java Thu Jun 19 16:54:13 2014
@@ -211,6 +211,7 @@ public class ServiceSet
meta_props.put("service-alive", "false");
meta_props.put("service-healthy", "false");
meta_props.put("service-statistics", "N/A");
+ meta_props.remove("submit-error");
last_use = meta_props.getLongProperty("last-use", 0L);
if ( last_use == 0 ) {
@@ -536,6 +537,8 @@ public class ServiceSet
{
run_failures = 0;
ping_failures = 0;
+ init_failures = 0;
+ meta_props.remove("submit-error");
excessiveRunFailures = false;
}
@@ -737,7 +740,12 @@ public class ServiceSet
meta_props.put("ping-active", "" + (serviceMeta != null));
meta_props.put("service-alive", "false");
meta_props.put("service-healthy", "false");
- meta_props.put("service-statistics", "N/A");
+
+ if ( excessiveFailures() ) {
+ meta_props.put("submit-error", "Service stopped by exessive failures. Initialization failures[" + init_failures + "], Runtime failures[" + run_failures + "]");
+ } else {
+ meta_props.put("service-statistics", "N/A");
+ }
if ( serviceMeta != null ) {
IServiceStatistics ss = serviceMeta.getServiceStatistics();
@@ -924,10 +932,20 @@ public class ServiceSet
}
}
+ public String getErrorString()
+ {
+ return meta_props.getProperty("submit-error");
+ }
+
public synchronized void reference(DuccId id)
{
String methodName = "reference";
+ if ( excessiveFailures() ) {
+ logger.warn(methodName, this.id, "Reference start fails, excessive failures: init[" + init_failures + "], run[" + run_failures + "]");
+ return;
+ }
+
cancelLinger();
references.put(id, id);
logger.info(methodName, this.id, " References job/service", id, "count[" + references.size() + "] implementors [" + implementors.size() + "]");
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDependency.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDependency.java?rev=1603942&r1=1603941&r2=1603942&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDependency.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDependency.java Thu Jun 19 16:54:13 2014
@@ -31,10 +31,12 @@ public class ServiceDependency implement
private ServiceState state = ServiceState.Undefined; // this is the cumulative service state for all the job's services
private Map<String, String> messages = null; // if anything needs more info we put strings into here
// one per service, keyed on service endpoint
+ private Map<String, ServiceState> individualState = null;
public ServiceDependency()
{
- this.messages = new HashMap<String, String>();
+ this.messages = new HashMap<String, String>();
+ this.individualState = new HashMap<String, ServiceState>();
}
/*
@@ -55,14 +57,16 @@ public class ServiceDependency implement
*/
public void setIndividualState(String endpoint, ServiceState state)
{
- messages.put(endpoint, state.decode());
+ individualState.put(endpoint, state);
}
/**
- * Set an error message about the individual services.
+ * Build up message string for service.
*/
public void addMessage(String endpoint, String message)
{
+ if ( message == null || message.equals("") ) return;
+
messages.put(endpoint, message);
}
@@ -76,7 +80,20 @@ public class ServiceDependency implement
public Map<String, String> getMessages()
{
- return messages;
+ HashMap<String, String> ret = new HashMap<String, String>();
+ for ( String ep : individualState.keySet() ) {
+ String msg = messages.get(ep);
+ String dec = individualState.get(ep).decode();
+ if ( msg == null ) {
+ ret.put(ep, dec);
+ } else {
+ msg = dec + "; " + msg;
+ ret.put(ep, msg);
+ }
+ }
+
+ return ret;
}
}
+