Author: degenaro Date: Tue Jan 31 14:27:59 2017 New Revision: 1781087 URL: http://svn.apache.org/viewvc?rev=1781087&view=rev Log: UIMA-5279 DUCC Web Server (WS) may show incorrect values for PgIn and Swap on mixed cgroup cluster
Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessConcurrentMap.java uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java?rev=1781087&r1=1781086&r2=1781087&view=diff ============================================================================== --- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java (original) +++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcess.java Tue Jan 31 14:27:59 2017 @@ -34,6 +34,19 @@ import org.apache.uima.ducc.transport.ev public class DuccProcess implements IDuccProcess { + public enum SpecialValue { + Unknown(-100), + Unavailable(-1), + ; + long sv = 0; + private SpecialValue(long value) { + sv = value; + } + long getlong() { + return sv; + } + } + /** * please increment this sUID when removing or modifying a field */ @@ -62,9 +75,9 @@ public class DuccProcess implements IDuc private boolean initialized = false; private int exitCode; private CGroup cgroup; - private long majorFaults; - private long swapUsage; - private long swapUsageMax; + private long majorFaults = SpecialValue.Unknown.getlong(); + private long swapUsage= SpecialValue.Unknown.getlong(); + private long swapUsageMax= SpecialValue.Unknown.getlong(); private long wiMillisInvestment; private long currentCPU; Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessConcurrentMap.java URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessConcurrentMap.java?rev=1781087&r1=1781086&r2=1781087&view=diff ============================================================================== --- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessConcurrentMap.java (original) +++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessConcurrentMap.java Tue Jan 31 14:27:59 2017 @@ -28,6 +28,7 @@ import org.apache.uima.ducc.common.NodeI import org.apache.uima.ducc.common.utils.DuccLogger; import org.apache.uima.ducc.common.utils.id.DuccId; import org.apache.uima.ducc.transport.Constants; +import org.apache.uima.ducc.transport.event.common.DuccProcess.SpecialValue; import org.apache.uima.ducc.transport.event.common.IProcessState.ProcessState; public class DuccProcessConcurrentMap extends ConcurrentHashMap<DuccId,IDuccProcess> implements IDuccProcessMap { @@ -350,12 +351,17 @@ public class DuccProcessConcurrentMap ex while(iterator.hasNext()) { IDuccProcess process = iterator.next(); long value = process.getMajorFaults(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value; + } } } } @@ -388,12 +394,17 @@ public class DuccProcessConcurrentMap ex while(iterator.hasNext()) { IDuccProcess process = iterator.next(); double value = process.getSwapUsage(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value/Constants.GB; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value/Constants.GB; + } } } } @@ -431,12 +442,17 @@ public class DuccProcessConcurrentMap ex while(iterator.hasNext()) { IDuccProcess process = iterator.next(); double value = process.getSwapUsageMax(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value/Constants.GB; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value/Constants.GB; + } } } } Modified: uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java?rev=1781087&r1=1781086&r2=1781087&view=diff ============================================================================== --- uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java (original) +++ uima/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/common/DuccProcessMap.java Tue Jan 31 14:27:59 2017 @@ -28,6 +28,7 @@ import org.apache.uima.ducc.common.NodeI import org.apache.uima.ducc.common.utils.DuccLogger; import org.apache.uima.ducc.common.utils.id.DuccId; import org.apache.uima.ducc.transport.Constants; +import org.apache.uima.ducc.transport.event.common.DuccProcess.SpecialValue; import org.apache.uima.ducc.transport.event.common.IProcessState.ProcessState; public class DuccProcessMap extends TreeMap<DuccId,IDuccProcess> implements IDuccProcessMap { @@ -356,12 +357,17 @@ public class DuccProcessMap extends Tree while(iterator.hasNext()) { IDuccProcess process = iterator.next(); long value = process.getMajorFaults(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value; + } } } } @@ -394,12 +400,17 @@ public class DuccProcessMap extends Tree while(iterator.hasNext()) { IDuccProcess process = iterator.next(); double value = process.getSwapUsage(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value/Constants.GB; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value/Constants.GB; + } } } } @@ -437,12 +448,17 @@ public class DuccProcessMap extends Tree while(iterator.hasNext()) { IDuccProcess process = iterator.next(); double value = process.getSwapUsageMax(); - if(value < 0) { - flagNoCgroup = true; + if(value == SpecialValue.Unknown.getlong()) { + // skip it } else { - flagCgroup = true; - retVal += value/Constants.GB; + if(value < 0) { + flagNoCgroup = true; + } + else { + flagCgroup = true; + retVal += value/Constants.GB; + } } } }