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 2016/04/13 15:57:01 UTC

svn commit: r1738944 - /uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java

Author: degenaro
Date: Wed Apr 13 13:57:01 2016
New Revision: 1738944

URL: http://svn.apache.org/viewvc?rev=1738944&view=rev
Log:
UIMA-4893 DUCC Web Server (WS) Machines page may display wrong memory free value

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java?rev=1738944&r1=1738943&r2=1738944&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/Distiller.java Wed Apr 13 13:57:01 2016
@@ -15,6 +15,7 @@ import org.apache.uima.ducc.transport.ev
 import org.apache.uima.ducc.transport.event.common.IDuccProcessMap;
 import org.apache.uima.ducc.transport.event.common.IDuccReservation;
 import org.apache.uima.ducc.transport.event.common.IDuccReservationMap;
+import org.apache.uima.ducc.transport.event.common.IDuccSchedulingInfo;
 import org.apache.uima.ducc.transport.event.common.IDuccWork;
 import org.apache.uima.ducc.transport.event.common.IDuccWorkJob;
 import org.apache.uima.ducc.transport.event.common.IDuccWorkMap;
@@ -101,7 +102,27 @@ public class Distiller {
 			logger.error(location, jobid, e);
 		}
 	}
+
+	// The OR publication value "reservation.getBytes()" should be non-zero for each
+	// reservation.  However, perhaps due to a "migration to DB" bug the field may be zero?
+	// In that case, use the value of "getSchedulingInfo().getMemorySizeAllocatedInBytes()"
+	// and log accordingly.  Note that the whole machine may not be shown as in-use by the 
+	// unmanaged reservation if the share size is not an exact multiple of the machine size 
+	// reported by the DUCC Agent.
 	
+	private static long fixBytes(IDuccWork dw) {
+		String location = "fixBytes";
+		long retVal = 0;
+		if(dw != null) {
+			IDuccSchedulingInfo si = dw.getSchedulingInfo();
+			SizeBytes sizeBytes = new SizeBytes(SizeBytes.Type.Bytes, si.getMemorySizeAllocatedInBytes());
+			retVal = sizeBytes.getBytes();
+			String text = "bytes="+retVal;
+			logger.warn(location, dw.getDuccId(), text);
+		}
+		return retVal;
+	}
+
 	// accumulate bytes allocated on each machine for each active reservation
 	private static void reservations(Map<String,Long> map, IDuccWorkMap dwm) {
 		String location = "reservations";
@@ -121,6 +142,9 @@ public class Distiller {
 									if(ni != null) {
 										String name = ni.getName();
 										if(name != null) {
+											if(bytes == 0) {
+												bytes = fixBytes(dw);
+											}
 											add(map, name, bytes);
 											SizeBytes sb = new SizeBytes(Type.Bytes,bytes);
 											String text = location+": "+name+"="+sb.getGBytes();