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 2016/12/14 17:37:52 UTC

svn commit: r1774298 - in /uima/uima-ducc/trunk: src/main/resources/ uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/

Author: cwiklik
Date: Wed Dec 14 17:37:52 2016
New Revision: 1774298

URL: http://svn.apache.org/viewvc?rev=1774298&view=rev
Log:
UIMA-5213 added duc.agent.rogue.process.sys.uid.max property and removed ducc.agent.node.metricss.sys.gid.max

Modified:
    uima/uima-ducc/trunk/src/main/resources/default.ducc.properties
    uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java
    uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java
    uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/Utils.java

Modified: uima/uima-ducc/trunk/src/main/resources/default.ducc.properties
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/resources/default.ducc.properties?rev=1774298&r1=1774297&r2=1774298&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/resources/default.ducc.properties (original)
+++ uima/uima-ducc/trunk/src/main/resources/default.ducc.properties Wed Dec 14 17:37:52 2016
@@ -754,10 +754,6 @@ ducc.agent.managed.process.state.update.
 
 # ***** Note: the Resource Manager uses the data in the node metrics for scheduling.
 
-# Max UID reserved by OS. This is used to detect rogue processes and to report
-# available memory on a node.
-ducc.agent.node.metrics.sys.uid.max=500
-
 # The interval in milliseconds between node metric publications.
 # Every agent publishes its updates at this rate.  On large clusters, a high rate (small 
 # interval) can be a burden on the network.
@@ -826,6 +822,14 @@ ducc.agent.launcher.process.stop.timeout
 # default = root,posstfix,ntp,nobody,daemon,100 
 ducc.agent.rogue.process.user.exclusion.filter=
 
+# Max UID reserved by OS. This is used to detect rogue processes and to report
+# available memory on a node.
+# The ducc.agent.node.metrics.sys.uid.max property is droped in favor of
+# ducc.agent.rogue.process.sys.user.max, which seems more descriptive
+#
+# ducc.agent.node.metrics.sys.uid.max=500  
+ducc.agent.rogue.process.sys.uid.max=500
+
 # Exclude the following processes while detecting rogue processes
 # The DUCC Agents scan nodes for processes that should not be running; for example, 
 # a job may have left a 'rogue' process alive when it exits, or a user may log in to a node 

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java?rev=1774298&r1=1774297&r2=1774298&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java Wed Dec 14 17:37:52 2016
@@ -34,7 +34,7 @@ import org.apache.uima.ducc.common.utils
 public class NodeMemInfoCollector implements CallableMemoryCollector {
 	private long fakeMemorySize = -1;
 	private String[] targetFields;
-    private int gidMax = 500;   // default. Used to sum up memory of processes owned by uids < gidMax
+    private int uidMax = 500;   // default. Used to sum up memory of processes owned by uids < uidMax
 	public NodeMemInfoCollector(String[] targetFields) {
 		this.targetFields = targetFields;
 		String tmp;
@@ -47,16 +47,8 @@ public class NodeMemInfoCollector implem
 				e.printStackTrace();
 			}
 		}
-		// SYSTEM_GID_MAX
-		if ((tmp = System
-				.getProperty("ducc.agent.node.metrics.sys.gid.max")) != null) {
-			try {
-				gidMax = Integer.valueOf(tmp);
-			} catch (NumberFormatException e) {
-				e.printStackTrace();
-			}
-		}
 
+		uidMax = Utils.getMaxSystemUserId();
 	}
 
 	public NodeMemory call() throws Exception {
@@ -130,7 +122,7 @@ public class NodeMemInfoCollector implem
 	          if ( tokens.length > 0 ) {
 	        	  try {
 	        		  int uid = Integer.valueOf(tokens[2]);
-	        		  if ( uid < gidMax ) {
+	        		  if ( uid < uidMax ) {
 	        			  memoryUsed += Long.valueOf(tokens[3]);
 	        		  }
 	        	  } catch( NumberFormatException nfe) {

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java?rev=1774298&r1=1774297&r2=1774298&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java Wed Dec 14 17:37:52 2016
@@ -50,36 +50,15 @@ public class NodeUsersCollector implemen
   Agent agent;
   
   
-  // gidMax is deprecated. New code should use uidMad. 12/13/2016 
-  int gidMax = 500;
-  // the gidMax should have been uidMax. Continue using both for the time being
-  // Processes owned by user id <= max user id are considered "system" and excluded from rogue
-  // process detection.
   int uidMax = 500;   // default 
-  
-  
   static String ducc_user = System.getProperty("user.name");
   
   public NodeUsersCollector(Agent agent, DuccLogger logger) {
     this.agent = agent;
     this.logger = logger;
-    String tmp;
-    // gidMax and uidMax mean the same thing. The gidMax is deprecated. New code should
-    // use uidMax.
-    if ((tmp = System
-			.getProperty("ducc.agent.node.metrics.sys.gid.max")) != null) {
-		if ( Utils.isNumber(tmp) ) {
-			uidMax = Integer.valueOf(tmp);  // use uidMax 
-		}
-	}
-	// in case both properties are set ...gid.max and ...uid.max, the latter wins
-    if ((tmp = System
-			.getProperty("ducc.agent.node.metrics.sys.uid.max")) != null) {
-		if ( Utils.isNumber(tmp) ) {
-			uidMax = Integer.valueOf(tmp);
-		}
-	} 
-	
+    // fetch max uid to be considered as a system user. Any process owned by
+    // user id < uidMax is not rogue and will be left running.
+    uidMax = Utils.getMaxSystemUserId();
   }
   /**
    * Returns true if a given userId belongs to an exclusion list defined in ducc.properties.
@@ -358,7 +337,7 @@ public class NodeUsersCollector implemen
             currentPids.add(pid);
             if ( logger == null ) {
             } else {
-              logger.trace(location, null,"Current Process (Before Calling aggregate() - PID:"+pid+" PPID:"+ppid+" Process List Size:"+processList.size());
+              logger.trace(location, null,"Current Promuscess (Before Calling aggregate() - PID:"+pid+" PPID:"+ppid+" Process List Size:"+processList.size());
             }
             NodeUsersCollector.ProcessInfo pi = 
                     new NodeUsersCollector.ProcessInfo(Integer.parseInt(pid),Integer.parseInt(ppid));

Modified: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/Utils.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/Utils.java?rev=1774298&r1=1774297&r2=1774298&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/Utils.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/Utils.java Wed Dec 14 17:37:52 2016
@@ -412,7 +412,28 @@ public class Utils {
 
 		return DUCC_HOME;
 	}
-
+	public static int getMaxSystemUserId() {
+		String tmp;
+		int uidMax=500;
+		
+	    // gidMax and uidMax mean the same thing. The ducc.agent.node.metrics.sys.gid.max is deprecated. New code should
+	    // use ducc.agent.rogue.process.sys.user.max
+	    if ((tmp = System
+				.getProperty("ducc.agent.node.metrics.sys.gid.max")) != null) {
+			if ( isNumber(tmp) ) {
+				uidMax = Integer.valueOf(tmp);  // use uidMax 
+			}
+		}
+	    
+		// in case both properties are set ...gid.max and ...user.max, the latter wins
+	    if ((tmp = System
+				.getProperty("ducc.agent.rogue.process.sys.uid.max")) != null) {
+			if ( isNumber(tmp) ) {
+				uidMax = Integer.valueOf(tmp);
+			}
+		} 
+	    return uidMax;
+	}
 	public static void main(String[] args) {
 		try {
 			if ( Utils.isThisNode("192.168.3.3", "192.168.3.3") ) {