You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2018/05/04 15:19:39 UTC

svn commit: r1830922 - in /uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task: DuccServiceTaskProtocolHandler.java TestTaskAllocatorCallbackListener.java

Author: cwiklik
Date: Fri May  4 15:19:39 2018
New Revision: 1830922

URL: http://svn.apache.org/viewvc?rev=1830922&view=rev
Log:
UIMA-5756 improved logging

Modified:
    uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/DuccServiceTaskProtocolHandler.java
    uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/TestTaskAllocatorCallbackListener.java

Modified: uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/DuccServiceTaskProtocolHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/DuccServiceTaskProtocolHandler.java?rev=1830922&r1=1830921&r2=1830922&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/DuccServiceTaskProtocolHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/DuccServiceTaskProtocolHandler.java Fri May  4 15:19:39 2018
@@ -81,15 +81,21 @@ public class DuccServiceTaskProtocolHand
 			Type type = trans.getType();
 			switch(type) {
 			case Get:
-				logger.log(Level.FINE,"---- Driver handling GET Request - Requestor:"+taskConsumer.toString());
+			    if ( logger.isLoggable(Level.FINE)) {
+					logger.log(Level.FINE,"---- Driver handling GET Request - Requestor:"+taskConsumer.toString());
+			    }
 				handleMetaTaskTransationGet(trans, taskConsumer);
 				break;
 			case Ack:
-				logger.log(Level.FINE,"---- Driver handling ACK Request - Requestor:"+taskConsumer.toString());
+			    if ( logger.isLoggable(Level.FINE)) {
+					logger.log(Level.FINE,"---- Driver handling ACK Request - Requestor:"+taskConsumer.toString());
+			    }
 				handleMetaTaskTransationAck(trans, taskConsumer);
 				break;
 			case End:
-				logger.log(Level.FINE,"---- Driver handling END Request - Requestor:"+taskConsumer.toString());
+			    if ( logger.isLoggable(Level.FINE)) {
+					logger.log(Level.FINE,"---- Driver handling END Request - Requestor:"+taskConsumer.toString());
+			    }
 				handleMetaTaskTransationEnd(trans, taskConsumer);
 				break;
 			case InvestmentReset:
@@ -140,7 +146,7 @@ public class DuccServiceTaskProtocolHand
 		// The max time we are willing to wait for a task is 60 secs
 		// with 2 secs wait time between retries. With the above
 		// the max number of retries is 30. When we reach the max
-		// retry, we return no work to the service.
+		// retry, we return empty task to the service.
 		long retryCount = 60/secondsToWait;
 		while( retryCount > 0 ) {
 			task = taskAllocator.getTask(taskConsumer);
@@ -156,6 +162,10 @@ public class DuccServiceTaskProtocolHand
 			} else {
 				IMetaTask metaTask = getMetaTask(task.asString());
 				mmc.setMetaCas(metaTask);
+			    if ( logger.isLoggable(Level.FINE)) {
+				   logger.log(Level.FINE,"Returning TASK with appdata:"+task.getMetadata()+" to the service");
+			    }
+				mmc.getMetaCas().setAppData(task.getMetadata());
 				break;
 			}
 			retryCount--;
@@ -193,7 +203,9 @@ public class DuccServiceTaskProtocolHand
 		} else {
 			String m = 
 					trans.getMetaTask().getPerformanceMetrics();
-			
+		    if ( logger.isLoggable(Level.FINE)) {
+		    	logger.log(Level.FINE,"handleMetaTaskTransationEnd()........... appdata:"+trans.getMetaTask().getAppData());
+		    }
 			taskAllocator.onTaskSuccess( taskConsumer,trans.getMetaTask().getAppData(), m );
 		}
 	}

Modified: uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/TestTaskAllocatorCallbackListener.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/TestTaskAllocatorCallbackListener.java?rev=1830922&r1=1830921&r2=1830922&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/TestTaskAllocatorCallbackListener.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/sd/task/TestTaskAllocatorCallbackListener.java Fri May  4 15:19:39 2018
@@ -97,7 +97,8 @@ public class TestTaskAllocatorCallbackLi
 	public synchronized void onTaskSuccess(TaskConsumer taskConsumer, String appdata, String processResult) {
 		logger.log(Level.INFO,"onTaskSuccess() Starting");
 		//List<Properties> breakdown = metrics.get();
-		System.out.println("\tmetrics: "+processResult);
+		//System.out.println("\tmetrics: "+processResult);
+		System.out.println("----------appdata: "+appdata);
 //		for( Properties p : breakdown ) {
 //			StringBuffer sb = new StringBuffer();
 //			sb.append("AE Name: ").append(p.get("uniqueName")).append(" Analysis Time: ").append(p.get("analysisTime"));