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/10/29 20:02:30 UTC

svn commit: r1536851 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator: StateJobAccounting.java StateManager.java

Author: degenaro
Date: Tue Oct 29 19:02:30 2013
New Revision: 1536851

URL: http://svn.apache.org/r1536851
Log:
UIMA-3337 DUCC orchestrator (OR) Failed Initialization for Service incorrectly marked Completed with EOJ??

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateManager.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java?rev=1536851&r1=1536850&r2=1536851&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java Tue Oct 29 19:02:30 2013
@@ -129,7 +129,15 @@ public class StateJobAccounting {
 			case Completing:
 				job.getStandardInfo().setDateOfCompletion(TimeStamp.getCurrentMillis());
 			}
-			recordUserState(job);
+			switch(state) {
+			case Completed:
+				recordUserState(job);
+				recordUserCompletion(job);
+				break;
+			default:
+				recordUserState(job);
+				break;
+			}
 			boolean advanceVal = advance(job);
 			if(!advanceVal) {
 				logger.info(methodName, job.getDuccId(),"current["+next+"] previous["+prev+"]");
@@ -293,6 +301,7 @@ public class StateJobAccounting {
 	public boolean complete(IDuccWorkJob job, JobCompletionType completionType, IRationale completionRationale) {
 		String methodName = "complete";
 		boolean retVal = false;
+		logger.debug(methodName, job.getDuccId(), job.getCompletionType()+" "+job.getCompletionRationale());
 		switch(job.getCompletionType()) {
 		case Undefined:
 			retVal = true;
@@ -301,7 +310,6 @@ public class StateJobAccounting {
 		if(retVal) {
 			job.setCompletion(completionType,completionRationale);
 			logger.info(methodName, job.getDuccId(), completionType+" "+completionRationale);
-			recordUserCompletion(job);
 		}
 		else {
 			logger.info(methodName, job.getDuccId(), completionType+" "+"ignored");
@@ -322,6 +330,7 @@ public class StateJobAccounting {
 			if(jobState != null) {
 				text = jobState.toString();
 				userLogging.toUserDuccLog(text);
+				logger.debug(methodName, job.getDuccId(), text);
 			}
 		}
 		catch(Exception e) {
@@ -340,13 +349,15 @@ public class StateJobAccounting {
 			UserLogging userLogging = new UserLogging(userName, userLogDir);
 			JobCompletionType jobCompletionType = job.getCompletionType();
 			if(jobCompletionType != null) {
-				text = jobCompletionType.toString();
+				text = "completion type: "+jobCompletionType.toString();
 				userLogging.toUserDuccLog(text);
+				logger.debug(methodName, job.getDuccId(), text);
 			}
 			IRationale rationale = job.getCompletionRationale();
 			if(rationale != null) {
-				text = rationale.toString();
+				text = "rationale: "+rationale.toString();
 				userLogging.toUserDuccLog(text);
+				logger.debug(methodName, job.getDuccId(), text);
 			}
 		}
 		catch(Exception e) {

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=1536851&r1=1536850&r2=1536851&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 Tue Oct 29 19:02:30 2013
@@ -1261,7 +1261,7 @@ public class StateManager {
 										OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
 									}
 									if(!service.hasAliveProcess()) {
-										completeJob(service, new Rationale("state manager reported no viable service process exists, type="+processType));
+										completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
 									}
 									break;
 								case Job_Uima_AS_Process:
@@ -1270,7 +1270,7 @@ public class StateManager {
 										OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
 									}
 									if(!service.hasAliveProcess()) {
-										completeJob(service, new Rationale("state manager reported no viable service process exists, type="+processType));
+										completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
 									}
 									break;
 								}
@@ -1333,7 +1333,6 @@ public class StateManager {
 		String location = "completeManagedReservation";
 		DuccId jobid = null;
 		try {
-			
 			jobid = service.getDuccId();
 			Map<DuccId, IDuccProcess> map = service.getProcessMap().getMap();
 			int size = map.size();
@@ -1365,13 +1364,27 @@ public class StateManager {
 		}
 	}
 	
+	private void completeService(DuccWorkJob service, IRationale rationale) {
+		if(service.getProcessFailureCount() > 0) {
+			service.setCompletion(JobCompletionType.Warning, new Rationale("process failure(s) occurred"));
+		}
+		else if(service.getProcessInitFailureCount() > 0) {
+			service.setCompletion(JobCompletionType.Warning, new Rationale("process initialization failure(s) occurred"));
+		}
+		else {
+			setCompletionIfNotAlreadySet(service, JobCompletionType.EndOfJob, rationale);
+		}
+		advanceToCompleted(service);
+	}
+	
 	private void completeJob(DuccWorkJob job, IRationale rationale) {
 		String location = "completeJob";
 		DuccId jobid = null;
 		switch(job.getCompletionType()) {
 		case Undefined:
-			job.setCompletion(JobCompletionType.EndOfJob, rationale);
+			job.setCompletion(JobCompletionType.Undefined, rationale);
 			job.getStandardInfo().setDateOfCompletion(TimeStamp.getCurrentMillis());
+			break;
 		case EndOfJob:
 			if(job.getProcessFailureCount() > 0) {
 				job.setCompletion(JobCompletionType.Warning, new Rationale("all work items completed, but job process failure(s) occurred"));