hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [17/31] hadoop git commit: YARN-3344. Fix warning - procfs stat file is not in the expected format. (Ravindra Kumar Naik and Akira Ajisaka via kasha)
Date Fri, 27 May 2016 04:39:51 GMT
YARN-3344. Fix warning - procfs stat file is not in the expected format. (Ravindra Kumar Naik
and Akira Ajisaka via kasha)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/77d5ce90
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/77d5ce90
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/77d5ce90

Branch: refs/heads/HDFS-1312
Commit: 77d5ce9069b9ad64673f04edac9b1b1beddfd403
Parents: e07519b
Author: Karthik Kambatla <kasha@apache.org>
Authored: Wed May 25 10:50:45 2016 -0700
Committer: Karthik Kambatla <kasha@apache.org>
Committed: Wed May 25 10:50:54 2016 -0700

----------------------------------------------------------------------
 .../yarn/util/ProcfsBasedProcessTree.java       | 11 ++--
 .../yarn/util/TestProcfsBasedProcessTree.java   | 66 ++++++++++----------
 2 files changed, 39 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/77d5ce90/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
index 4fb4be3..bb9c183 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
@@ -57,10 +57,10 @@ public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree
{
 
   private static final String PROCFS = "/proc/";
 
-  private static final Pattern PROCFS_STAT_FILE_FORMAT = Pattern .compile(
-    "^([0-9-]+)\\s([^\\s]+)\\s[^\\s]\\s([0-9-]+)\\s([0-9-]+)\\s([0-9-]+)\\s" +
-    "([0-9-]+\\s){7}([0-9]+)\\s([0-9]+)\\s([0-9-]+\\s){7}([0-9]+)\\s([0-9]+)" +
-    "(\\s[0-9-]+){15}");
+  private static final Pattern PROCFS_STAT_FILE_FORMAT = Pattern.compile(
+      "^([\\d-]+)\\s\\(([^)]+)\\)\\s[^\\s]\\s([\\d-]+)\\s([\\d-]+)\\s" +
+      "([\\d-]+)\\s([\\d-]+\\s){7}(\\d+)\\s(\\d+)\\s([\\d-]+\\s){7}(\\d+)\\s" +
+      "(\\d+)(\\s[\\d-]+){15}");
 
   public static final String PROCFS_STAT_FILE = "stat";
   public static final String PROCFS_CMDLINE_FILE = "cmdline";
@@ -537,8 +537,9 @@ public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree
{
       Matcher m = PROCFS_STAT_FILE_FORMAT.matcher(str);
       boolean mat = m.find();
       if (mat) {
+        String processName = "(" + m.group(2) + ")";
         // Set (name) (ppid) (pgrpId) (session) (utime) (stime) (vsize) (rss)
-        pinfo.updateProcessInfo(m.group(2), m.group(3),
+        pinfo.updateProcessInfo(processName, m.group(3),
                 Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)),
                 Long.parseLong(m.group(7)), new BigInteger(m.group(8)),
                 Long.parseLong(m.group(10)), Long.parseLong(m.group(11)));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/77d5ce90/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java
index 6fbbfbe..fa4e8c8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java
@@ -414,17 +414,17 @@ public class TestProcfsBasedProcessTree {
       // assuming processes 100, 200, 300 are in tree and 400 is not.
       ProcessStatInfo[] procInfos = new ProcessStatInfo[4];
       procInfos[0] =
-          new ProcessStatInfo(new String[] { "100", "proc1", "1", "100", "100",
-              "100000", "100", "1000", "200" });
+          new ProcessStatInfo(new String[]{"100", "proc1", "1", "100", "100",
+              "100000", "100", "1000", "200"});
       procInfos[1] =
-          new ProcessStatInfo(new String[] { "200", "proc2", "100", "100",
-              "100", "200000", "200", "2000", "400" });
+          new ProcessStatInfo(new String[]{"200", "process two", "100", "100",
+              "100", "200000", "200", "2000", "400"});
       procInfos[2] =
-          new ProcessStatInfo(new String[] { "300", "proc3", "200", "100",
-              "100", "300000", "300", "3000", "600" });
+          new ProcessStatInfo(new String[]{"300", "proc3", "200", "100",
+              "100", "300000", "300", "3000", "600"});
       procInfos[3] =
-          new ProcessStatInfo(new String[] { "400", "proc4", "1", "400", "400",
-              "400000", "400", "4000", "800" });
+          new ProcessStatInfo(new String[]{"400", "proc4", "1", "400", "400",
+              "400000", "400", "4000", "800"});
 
       ProcessTreeSmapMemInfo[] memInfo = new ProcessTreeSmapMemInfo[4];
       memInfo[0] = new ProcessTreeSmapMemInfo("100");
@@ -481,11 +481,11 @@ public class TestProcfsBasedProcessTree {
 
       // test the cpu time again to see if it cumulates
       procInfos[0] =
-          new ProcessStatInfo(new String[] { "100", "proc1", "1", "100", "100",
-              "100000", "100", "2000", "300" });
+          new ProcessStatInfo(new String[]{"100", "proc1", "1", "100", "100",
+              "100000", "100", "2000", "300"});
       procInfos[1] =
-          new ProcessStatInfo(new String[] { "200", "proc2", "100", "100",
-              "100", "200000", "200", "3000", "500" });
+          new ProcessStatInfo(new String[]{"200", "process two", "100", "100",
+              "100", "200000", "200", "3000", "500"});
       writeStatFiles(procfsRootDir, pids, procInfos, memInfo);
 
       long elapsedTimeBetweenUpdatesMsec = 200000;
@@ -558,17 +558,17 @@ public class TestProcfsBasedProcessTree {
       // assuming 100, 200 and 400 are in tree, 300 is not.
       ProcessStatInfo[] procInfos = new ProcessStatInfo[4];
       procInfos[0] =
-          new ProcessStatInfo(new String[] { "100", "proc1", "1", "100", "100",
-              "100000", "100" });
+          new ProcessStatInfo(new String[]{"100", "proc1", "1", "100", "100",
+              "100000", "100"});
       procInfos[1] =
-          new ProcessStatInfo(new String[] { "200", "proc2", "100", "100",
-              "100", "200000", "200" });
+          new ProcessStatInfo(new String[]{"200", "process two", "100", "100",
+              "100", "200000", "200"});
       procInfos[2] =
-          new ProcessStatInfo(new String[] { "300", "proc3", "1", "300", "300",
-              "300000", "300" });
+          new ProcessStatInfo(new String[]{"300", "proc3", "1", "300", "300",
+              "300000", "300"});
       procInfos[3] =
-          new ProcessStatInfo(new String[] { "400", "proc4", "100", "100",
-              "100", "400000", "400" });
+          new ProcessStatInfo(new String[]{"400", "proc4", "100", "100",
+              "100", "400000", "400"});
       // write smap information invariably for testing
       ProcessTreeSmapMemInfo[] memInfo = new ProcessTreeSmapMemInfo[4];
       memInfo[0] = new ProcessTreeSmapMemInfo("100");
@@ -804,23 +804,23 @@ public class TestProcfsBasedProcessTree {
       // Processes 200, 300, 400 and 500 are descendants of 100. 600 is not.
       ProcessStatInfo[] procInfos = new ProcessStatInfo[numProcesses];
       procInfos[0] =
-          new ProcessStatInfo(new String[] { "100", "proc1", "1", "100", "100",
-              "100000", "100", "1000", "200" });
+          new ProcessStatInfo(new String[]{"100", "proc1", "1", "100", "100",
+              "100000", "100", "1000", "200"});
       procInfos[1] =
-          new ProcessStatInfo(new String[] { "200", "proc2", "100", "100",
-              "100", "200000", "200", "2000", "400" });
+          new ProcessStatInfo(new String[]{"200", "process two", "100", "100",
+              "100", "200000", "200", "2000", "400"});
       procInfos[2] =
-          new ProcessStatInfo(new String[] { "300", "proc3", "200", "100",
-              "100", "300000", "300", "3000", "600" });
+          new ProcessStatInfo(new String[]{"300", "proc3", "200", "100",
+              "100", "300000", "300", "3000", "600"});
       procInfos[3] =
-          new ProcessStatInfo(new String[] { "400", "proc4", "200", "100",
-              "100", "400000", "400", "4000", "800" });
+          new ProcessStatInfo(new String[]{"400", "proc4", "200", "100",
+              "100", "400000", "400", "4000", "800"});
       procInfos[4] =
-          new ProcessStatInfo(new String[] { "500", "proc5", "400", "100",
-              "100", "400000", "400", "4000", "800" });
+          new ProcessStatInfo(new String[]{"500", "proc5", "400", "100",
+              "100", "400000", "400", "4000", "800"});
       procInfos[5] =
-          new ProcessStatInfo(new String[] { "600", "proc6", "1", "1", "1",
-              "400000", "400", "4000", "800" });
+          new ProcessStatInfo(new String[]{"600", "proc6", "1", "1", "1",
+              "400000", "400", "4000", "800"});
 
       ProcessTreeSmapMemInfo[] memInfos = new ProcessTreeSmapMemInfo[6];
       memInfos[0] = new ProcessTreeSmapMemInfo("100");
@@ -832,7 +832,7 @@ public class TestProcfsBasedProcessTree {
 
       String[] cmdLines = new String[numProcesses];
       cmdLines[0] = "proc1 arg1 arg2";
-      cmdLines[1] = "proc2 arg3 arg4";
+      cmdLines[1] = "process two arg3 arg4";
       cmdLines[2] = "proc3 arg5 arg6";
       cmdLines[3] = "proc4 arg7 arg8";
       cmdLines[4] = "proc5 arg9 arg10";


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message