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 <[email protected]>
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.

**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 <[email protected]>
Signed-off-by: zky.zhoukeyong <[email protected]>
---
.../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()
}