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

zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 61fadd57b [CELEBORN-665] Skip empty app snapshot logs
61fadd57b is described below

commit 61fadd57bd43ba6ac374000495cb7fb10b702484
Author: sychen <[email protected]>
AuthorDate: Thu Oct 12 21:12:15 2023 +0800

    [CELEBORN-665] Skip empty app snapshot logs
    
    ### What changes were proposed in this pull request?
    
    ### Why are the changes needed?
    
    ### Does this PR introduce _any_ user-facing change?
    
    ### How was this patch tested?
    
    Closes #1973 from cxzl25/CELEBORN-665.
    
    Authored-by: sychen <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 .../org/apache/celeborn/common/meta/AppDiskUsageMetric.scala   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
 
b/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
index 00f1a9fbc..8dd2d97cd 100644
--- 
a/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
+++ 
b/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
@@ -30,7 +30,7 @@ import org.apache.celeborn.common.util.{ThreadUtils, Utils}
 
 case class AppDiskUsage(var appId: String, var estimatedUsage: Long) {
   override def toString: String =
-    s"Application ${appId} used approximate 
${Utils.bytesToString(estimatedUsage)} "
+    s"Application $appId used approximate 
${Utils.bytesToString(estimatedUsage)} "
 }
 
 class AppDiskUsageSnapShot(val topItemCount: Int) extends Logging with 
Serializable {
@@ -81,7 +81,7 @@ class AppDiskUsageSnapShot(val topItemCount: Int) extends 
Logging with Serializa
 
   def restoreFromSnapshot(array: Array[AppDiskUsage]): Unit = {
     // Restored snapshots only contains values not null
-    for (i <- 0 until (topItemCount)) {
+    for (i <- 0 until topItemCount) {
       if (i < array.length) {
         topNItems(i) = array(i)
       } else {
@@ -143,7 +143,7 @@ class AppDiskUsageMetric(conf: CelebornConf) extends 
Logging {
           currentSnapShot.get().commit()
         }
         currentSnapShot.set(getNewSnapShot())
-        logInfo(s"App Disk Usage Top${usageCount} Report ${summary()}")
+        logInfo(s"App Disk Usage Top$usageCount Report ${summary()}")
       }
     },
     60,
@@ -161,7 +161,7 @@ class AppDiskUsageMetric(conf: CelebornConf) extends 
Logging {
   def summary(): String = {
     val stringBuilder = new StringBuilder()
     for (i <- 0 until snapshotCount) {
-      if (snapShots(i) != null) {
+      if (snapShots(i) != null && snapShots(i).topNItems.length != 0) {
         stringBuilder.append(snapShots(i))
         stringBuilder.append("    \n")
       }
@@ -171,7 +171,7 @@ class AppDiskUsageMetric(conf: CelebornConf) extends 
Logging {
 
   def restoreFromSnapshot(array: Array[AppDiskUsageSnapShot]): Unit = {
     // Restored snapshots only contains values not null
-    for (i <- 0 until (snapshotCount)) {
+    for (i <- 0 until snapshotCount) {
       if (i < array.length) {
         snapShots(i) = array(i)
       } else {

Reply via email to