You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by mr...@apache.org on 2022/11/08 18:24:47 UTC

[spark] branch master updated: [SPARK-41051][CORE] Optimize ProcfsMetrics file acquisition

This is an automated email from the ASF dual-hosted git repository.

mridulm80 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d29403bf0f [SPARK-41051][CORE] Optimize ProcfsMetrics file acquisition
1d29403bf0f is described below

commit 1d29403bf0fbeaebb427b8d8fa863744d689074c
Author: mask <Na...@hotmail.com>
AuthorDate: Tue Nov 8 12:24:20 2022 -0600

    [SPARK-41051][CORE] Optimize ProcfsMetrics file acquisition
    
    What changes were proposed in this pull request?
    Reuse variables from declared procfs files instead of duplicate code
    
    Why are the changes needed?
    The cost of looking up the config is often insignificant, but there
    reduce some duplicate code
    
    Does this PR introduce any user-facing change?
    No.
    
    How was this patch tested?
    Existing unit tests.
    
    Closes #41051 from sus/[SPARK-41051](https://issues.apache.org/jira/browse/SPARK-41051).
    
    Closes #38563 from Narcasserun/optimizer_val.
    
    Authored-by: mask <Na...@hotmail.com>
    Signed-off-by: Mridul <mridul<at>gmail.com>
---
 core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala b/core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala
index 547d9df4e4f..2c9ccbc5d86 100644
--- a/core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala
+++ b/core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala
@@ -170,7 +170,7 @@ private[spark] class ProcfsMetricsGetter(procfsDir: String = "/proc/") extends L
     try {
       val pidDir = new File(procfsDir, pid.toString)
       def openReader(): BufferedReader = {
-        val f = new File(new File(procfsDir, pid.toString), procfsStatFile)
+        val f = new File(pidDir, procfsStatFile)
         new BufferedReader(new InputStreamReader(new FileInputStream(f), UTF_8))
       }
       Utils.tryWithResource(openReader) { in =>


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