You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by zh...@apache.org on 2023/10/17 12:52:45 UTC

[incubator-celeborn] branch main updated: [CELEBORN-1044] Enhance the check of parameter array length

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 f6dcfaa37 [CELEBORN-1044] Enhance the check of parameter array length
f6dcfaa37 is described below

commit f6dcfaa37fed8d595eaa652ad61fb5992db4cd33
Author: xleoken <le...@163.com>
AuthorDate: Tue Oct 17 20:52:36 2023 +0800

    [CELEBORN-1044] Enhance the check of parameter array length
    
    ### What changes were proposed in this pull request?
    
    We can't get any response from /conf when the master started with default celeborn conf.
    
    ![e8c649b733e0c8495bb6555dfb7c5e58_13063594_image-2023-10-17-11-37-15-261](https://github.com/apache/incubator-celeborn/assets/95013770/a6de4496-f53f-46ad-94b6-e02adaa6fbfc)
    
    **Internal Exception**
    ```
    empty.max
    java.lang.UnsupportedOperationException: empty.max
            at scala.collection.TraversableOnce.max(TraversableOnce.scala:275)
            at scala.collection.TraversableOnce.max$(TraversableOnce.scala:273)
            at scala.collection.AbstractTraversable.max(Traversable.scala:108)
            at org.apache.celeborn.server.common.HttpService.getConf(HttpService.scala:36)
            at org.apache.celeborn.service.deploy.master.MasterSuite.$anonfun$new$1(MasterSuite.scala:46)
    ```
    
    ### Why are the changes needed?
    
    Bug.
    
    ### How was this patch tested?
    
    Local
    
    Closes #1995 from xleoken/patch5.
    
    Authored-by: xleoken <le...@163.com>
    Signed-off-by: zky.zhoukeyong <zk...@alibaba-inc.com>
---
 .../org/apache/celeborn/service/deploy/master/MasterSuite.scala   | 3 ++-
 .../scala/org/apache/celeborn/server/common/HttpService.scala     | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/master/src/test/scala/org/apache/celeborn/service/deploy/master/MasterSuite.scala b/master/src/test/scala/org/apache/celeborn/service/deploy/master/MasterSuite.scala
index 50c966783..46fbd67a6 100644
--- a/master/src/test/scala/org/apache/celeborn/service/deploy/master/MasterSuite.scala
+++ b/master/src/test/scala/org/apache/celeborn/service/deploy/master/MasterSuite.scala
@@ -17,6 +17,7 @@
 
 package org.apache.celeborn.service.deploy.master
 
+import com.google.common.io.Files
 import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
 import org.scalatest.funsuite.AnyFunSuite
 
@@ -30,7 +31,7 @@ class MasterSuite extends AnyFunSuite
   with Logging {
 
   def getTmpDir(): String = {
-    val tmpDir = com.google.common.io.Files.createTempDir()
+    val tmpDir = Files.createTempDir()
     tmpDir.deleteOnExit()
     tmpDir.getAbsolutePath
   }
diff --git a/service/src/main/scala/org/apache/celeborn/server/common/HttpService.scala b/service/src/main/scala/org/apache/celeborn/server/common/HttpService.scala
index 082493cfd..4390c369d 100644
--- a/service/src/main/scala/org/apache/celeborn/server/common/HttpService.scala
+++ b/service/src/main/scala/org/apache/celeborn/server/common/HttpService.scala
@@ -33,10 +33,12 @@ abstract class HttpService extends Service with Logging {
 
   def getConf: String = {
     val sb = new StringBuilder
-    val maxKeyLength = conf.getAll.toMap.keys.map(_.length).max
     sb.append("=========================== Configuration ============================\n")
-    conf.getAll.foreach { case (key, value) =>
-      sb.append(s"${key.padTo(maxKeyLength + 10, " ").mkString}$value\n")
+    if (conf.getAll.length > 0) {
+      val maxKeyLength = conf.getAll.toMap.keys.map(_.length).max
+      conf.getAll.foreach { case (key, value) =>
+        sb.append(s"${key.padTo(maxKeyLength + 10, " ").mkString}$value\n")
+      }
     }
     sb.toString()
   }