baohe-zhang commented on a change in pull request #31945:
URL: https://github.com/apache/spark/pull/31945#discussion_r600193366



##########
File path: 
core/src/test/scala/org/apache/spark/executor/ProcfsMetricsGetterSuite.scala
##########
@@ -38,4 +40,26 @@ class ProcfsMetricsGetterSuite extends SparkFunSuite {
     assert(r.jvmVmemTotal == 4769947648L)
     assert(r.jvmRSSTotal == 262610944)
   }
+
+  test("partial metrics shouldn't be returned") {

Review comment:
       Done

##########
File path: 
core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala
##########
@@ -210,11 +212,16 @@ private[spark] class ProcfsMetricsGetter(procfsDir: 
String = "/proc/") extends L
     val pids = computeProcessTree
     var allMetrics = ProcfsMetrics(0, 0, 0, 0, 0, 0)
     for (p <- pids) {
-      allMetrics = addProcfsMetricsFromOneProcess(allMetrics, p)
-      // if we had an error getting any of the metrics, we don't want to 
report partial metrics, as
-      // that would be misleading.
-      if (!isAvailable) {
-        return ProcfsMetrics(0, 0, 0, 0, 0, 0)
+      try {
+        allMetrics = addProcfsMetricsFromOneProcess(allMetrics, p)
+        // if we had an error getting any of the metrics, we don't want to
+        // report partial metrics, as that would be misleading.
+        if (!isAvailable) {
+          return ProcfsMetrics(0, 0, 0, 0, 0, 0)
+        }
+      } catch {
+        case f: IOException =>

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to